Skip to content

NoTypeInformation Incorrectly Colored #23

Closed

Description

@bcrotty

The Export-Csv parameter "-NoTypeInformation" has only the first 3 characters colored. This is probably incorrectly identifying it as "-not".

Activity

  1. vors commented on Dec 6, 2014

    @vors
    Member

    This 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.

    @guillermooo what do you think?

    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.

  2. bcrotty commented on Feb 18, 2015

    @bcrotty
    ContributorAuthor

    Fixed as of 2.1.0

  3. added theissue type on Dec 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions