-
Notifications
You must be signed in to change notification settings - Fork 81
Update PowershellSyntax.tmLanguage #57
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
Conversation
Fixes several issues: 229: Correctly highlights the operators -clt, -cle, -cgt, cge 235: Fixes issues highlighting paths with symbols in them 259 & 265: Fixes issues with operator highlighting, such as -NoTypeInformation being incorrectly highlighted as two elements, but allows for -Not1 to be correctly interpreted as two elements 393: Allows for permissible symbols in command names
@@ -226,13 +226,13 @@ | |||
</dict> | |||
<dict> | |||
<key>match</key> | |||
<string>-([lg][te]|[ci]?(eq|ne))</string> | |||
<string>-([ci]?[lg][te]|eq|ne)</string> |
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'm barely understanding what's going on here. Can you provide some comment?
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.
The previous syntax did not allow for the -clt
, -cle
, -cgt
, -cge
operators. By moving the [ci]
to the beginning, these are now enabled.
This now does not allow ```<```, ```>```, ```"```, ```/```, ```|```, ```?```, or ```*``` in the path.
<key>name</key> | ||
<string>keyword.operator.logical.powershell</string> | ||
</dict> | ||
<dict> | ||
<key>match</key> | ||
<string>(?i:[a-z][a-z0-9]+-?[a-z][a-z0-9]+)(?i:\.(?:exe|cmd|bat|ps1))</string> | ||
<string>(?i:(\S&&[^<>"/\|?*])+)(?i:\.(?:exe|cmd|bat|ps1))</string> |
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.
This now does not allow <
, >
, "
, /
, |
, ?
, or *
in the path.
Great, nice job! I will really appreciate if you can include test cases for new syntax (like in https://github.com/SublimeText/PowerShell/blob/dev/tests/syntax_def/test_syntax.py) to avoid regressions in future. |
I could use some help with that. I think I figured out how to test that |
Sorry for a long reply time, I was on a vacation. Let's work on the tests together. I should have time on this weekend. |
I started work on a new approach for tests: compare sublime syntax regions to PS tokens produced by parser. I hope it will allow us to avoid verbose test-writing. Because of that, I would not ask you to add tests. |
Update PowershellSyntax.tmLanguage
Fixes several issues:
229: Correctly highlights the operators
-clt
,-cle
,-cgt
,-cge
235: Fixes issues highlighting paths with symbols in them
259 & 265: Fixes issues with operator highlighting, such as
-NoTypeInformation
being incorrectly highlighted as two elements, but allows for-Not1
to be correctly interpreted as two elements393: Allows for permissible symbols in command names