Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Fix operators followed immediately by numbers #206

Copy link
Copy link
@michaelblyons

Description

@michaelblyons
Issue body actions

The word break problem shows up on other keyword-prefixes (like -bxor)
I investigated it and there is a simple fix: add \b for word boundary

https://github.com/SublimeText/PowerShell/blob/dev/Support/PowershellSyntax.tmLanguage#L265

-           <string>-(?i:and|or|not|xor)|!</string>
+           <string>-(?i:and|or|not|xor)\b|!</string>

The tricky part that it's not a 100% accurate fix. In PS it's legal to write -not1 and 1-bxor1, without spaces.

A proper fix will be relatively complicated: we need to recognize that context implies function call and turn-off keyword highlighting for all -bla keywords. It's pretty easy to introduce new bugs, when implementing this, so I would prefer implement it with reasonable test coverage.

PS: -not1 ideally should be recognized correctly (highlight -not part), but I have no idea how to do it without using PS parser or over-engineering.

Originally posted by @vors in #23

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.