-
Notifications
You must be signed in to change notification settings - Fork 21
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
Fix is not
syntax highlighting
#260
Conversation
@@ -37,7 +37,7 @@ To enable Emmet on your `html-hubl` files, you can map `html-hubl` to `html` in | |||
|
|||
### IntelliSense Suggestions | |||
|
|||
If you are would like to get IntelliSense suggestions when in snippet placeholders, you will need to add the following to your user settings: | |||
If you would like to get IntelliSense suggestions when in snippet placeholders, you will need to add the following to your user settings: |
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.
Also fixes a typo
{ | ||
"match": "\\b(and|else|if|in|import|(is )?not|or|recursive|with(out)?\\s+context)\\b", | ||
"name": "keyword.control.hubl" | ||
}, |
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.
I moved this up in the file so that it takes precedence over the x is y
syntax highlighting, which was breaking the x is not y
syntax highlight, since it was being captured as x (is) not y
instead of x (is not) y
. I've also added the optional group (is )?
so it captures is not
here.
@@ -115,7 +119,7 @@ | |||
"name": "variable.other.hubl.test" | |||
} | |||
}, | |||
"match": "\\s*\\b(is)\\s+([a-zA-Z_][a-zA-Z0-9_]*)\\b" | |||
"match": "\\s*\\b(is)(?!\\s+not)\\s+([a-zA-Z_][a-zA-Z0-9_]*)\\b" |
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.
Added a non-capturing group for is
so that this doesn't match x is not y
, only x is y
. We need to keep this group around because the alternative (adding is
to the group above) would match independent is
tokens incorrectly, so x not is y
would get highlighted as an operator which seems undesirable (really we should error on that but outside the scope of this change).
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.
Awesome, thanks for getting this quick fix in
Context: Issue #257
The token
is not
was being incorrectly captured in our syntax. This PR updates the syntax regex to correctly capture this token. Here is a test snippet from the original issue, and the updated syntax highlighting:Before
After