-
Notifications
You must be signed in to change notification settings - Fork 358
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
Possible issues with jsFuncBlock detection for arrow functions not wrapped in parens/curly-braces #1231
Comments
Yeah, this is definitely a known issue, but I haven't had time to dig into it. It's something to do with syntax priorities I think... |
True, I tried my hand @ fixing this a few times & the closest I managed to get is the following modification to the -syntax region jsClassBlock contained matchgroup=jsClassBraces start=/{/ end=/}/ contains=jsClassFuncName,jsClassMethodType,jsArrowFunction,jsArrowFuncArgs,jsComment,jsGenerator,jsDecorator,jsClassProperty,jsClassPropertyComputed,jsClassStringKey,jsAsyncKeyword,jsNoise extend fold
+syntax region jsClassBlock contained matchgroup=jsClassBraces start=/{/ end=/}/ contains=@jsExpression,jsClassFuncName,jsClassMethodType,jsArrowFunction,jsArrowFuncArgs,jsComment,jsGenerator,jsDecorator,jsClassProperty,jsClassPropertyComputed,jsClassStringKey,jsAsyncKeyword,jsNoise extend fold However, I then had to make this modification to the -syntax match jsClassProperty contained /\<\K\k*\ze\s*[=;]/ skipwhite skipempty nextgroup=jsClassValue,jsFlowClassDef
+syntax match jsClassProperty contained /\<\K\k*\ze\s*[=]/ skipwhite skipempty nextgroup=jsClassValue,jsFlowClassDef |
It's been a bit since I've work on this, but pretty sure that change will then allow a whole slew of other stuff to exist within |
My original solution was to create a new syntax region jsArrowFuncBlock contained matchgroup=jsFuncBraces start=/=>/ end=/;/ contains=@jsAll,jsBlock extend fold Not even sure if the theory is correct either. Seems like I need to match everything from the beginning of a |
So I am 90% sure the issue is not actually related to any problem with our existing regexes for arrow functions, the issue is simply a priority issue. I think we just have to re-sort a few of the items to fix it |
Interesting.... I will try some re-ordering on my end and see if I can find the magic order that fixes this 😇 |
Running this plugin alone with no other plugins. On basic js files it seems that we have having some trouble detecting a
jsFuncBlock
on arrow functions that are one-line and have no{ }
or( )
surrounding the function body.Bellow is an image the demonstrates this issue. The first two functions have the function's body wrapped in
{ }
or( )
. They highlight correctly but the last function does not.The text was updated successfully, but these errors were encountered: