Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

broken indenting/bracket jump when some RegExp passed as fn arg #149

Open
jaawerth opened this issue Aug 19, 2017 · 1 comment
Open

broken indenting/bracket jump when some RegExp passed as fn arg #149

jaawerth opened this issue Aug 19, 2017 · 1 comment

Comments

@jaawerth
Copy link

jaawerth commented Aug 19, 2017

Hi there! Overall I love the plugin, but I've encountered a bug a few times that I wanted to file:

When certain RegExp literals (from what I can tell, anything ending in .$, '*$', '+$', and any other non-alphanumeric character I've tried followed by $) are passed directly into functions, the following line(s) are auto-indented. You can set them back, but triggering auto-indent in anyway puts it back where it was. It seems like yajs isn't recognizing the close paren at the end of the function invocation, because it also skips the ) when using % to jump between start and end.

I've run into this a few times, but in this case I boiled down the most recent regex to cause it to anything ending in .$.

Test Case

function foo() {}
foo(/whatever.$/); // hitting % on the open paren will jump to the next close paren it sees in file
  // this line will auto-indent

Assigning the RegExp to a variable first and passing that in won't cause the indent

function foo(){}
const reg = /whatever.$/;
// no indent here
foo(reg)

Thanks!

@jaawerth jaawerth changed the title broken indenting when some RegExp passed as fn arg broken indenting/bracket jump when some RegExp passed as fn arg Aug 19, 2017
@othree
Copy link
Owner

othree commented Jan 23, 2018

Hi, sorry reply so late.
I don't have this issue in my environment.
Can you test again to see is this issue still exists?

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants