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

adding optional chaining operator #1053

Merged
merged 5 commits into from Oct 11, 2017
Merged

adding optional chaining operator #1053

merged 5 commits into from Oct 11, 2017

Conversation

npeeples
Copy link
Contributor

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.

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.
@bounceme
Copy link
Collaborator

(the ?. token must not be immediately followed by a decimal digit)

thanks for letting us know, will add the indentation parsing updates for this

@bounceme
Copy link
Collaborator

bounceme commented Sep 27, 2017

here is the regex: ?\%(\.\d\@!\)\@!

edit: for regular ?

@@ -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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will fail at eol

@npeeples
Copy link
Contributor Author

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 ?. there doesn't seem to be anything that's just pulling out a regular question mark, and I'm not familiar enough with how the vim syntax files work to understand if there's something else that should be done.

@npeeples
Copy link
Contributor Author

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.

@bounceme
Copy link
Collaborator

I think @amadeus might be able to show us how it's done

@bounceme bounceme merged commit 3ed61c9 into pangloss:master Oct 11, 2017
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

Successfully merging this pull request may close these issues.

None yet

2 participants