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
adding optional chaining operator #1053
Conversation
https://github.com/tc39/proposal-optional-chaining The only thing that could be bad about this is that 'x?.3:0' is apparently allowed as a ternary operator. I'm not really sure if that applies to the syntax highlighter, and is really not a great statement anyway.
thanks for letting us know, will add the indentation parsing updates for this |
here is the regex: edit: for regular |
syntax/javascript.vim
Outdated
@@ -162,7 +163,7 @@ syntax region jsBlock matchgroup=jsBraces s | |||
syntax region jsModuleGroup contained matchgroup=jsModuleBraces start=/{/ end=/}/ contains=jsModuleKeyword,jsModuleComma,jsModuleAs,jsComment,jsFlowTypeKeyword skipwhite skipempty nextgroup=jsFrom fold | |||
syntax region jsSpreadExpression contained matchgroup=jsSpreadOperator start=/\.\.\./ end=/[,}\]]\@=/ contains=@jsExpression | |||
syntax region jsRestExpression contained matchgroup=jsRestOperator start=/\.\.\./ end=/[,)]\@=/ | |||
syntax region jsTernaryIf matchgroup=jsTernaryIfOperator start=/?/ end=/\%(:\|[\}]\@=\)/ contains=@jsExpression extend skipwhite skipempty nextgroup=@jsExpression | |||
syntax region jsTernaryIf matchgroup=jsTernaryIfOperator start=/?[^\.]/ end=/\%(:\|[\}]\@=\)/ contains=@jsExpression extend skipwhite skipempty nextgroup=@jsExpression |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will fail at eol
thanks for the feedback. not going to lie, I just threw some things in there to make it work, but I'm not really sure where that regex should go for a regular |
Ok, I think I'm understanding now. That regex is for matching the start of the ternary operator... wow, that's quite the syntax for regex on these vim files. |
I think @amadeus might be able to show us how it's done |
https://github.com/tc39/proposal-optional-chaining
The only thing that could be bad about this is that 'x?.3:0' is
apparently allowed as a ternary operator. I'm not really sure if that
applies to the syntax highlighter, and is really not a great statement
anyway.