PowerShell / EditorSyntax

PowerShell syntax highlighting for editors (VS Code, Atom, SublimeText, TextMate, etc.) and GitHub!
MIT License
133 stars 45 forks source link

Hidden is getting wrong color as parameter. #121

Open PrzemyslawKlys opened 6 years ago

PrzemyslawKlys commented 6 years ago

Environment

Issue Description

I've created function

function Set-WordTextHidden {
    param(
        [parameter(ValueFromPipelineByPropertyName, ValueFromPipeline)][Xceed.Words.NET.InsertBeforeOrAfter] $Paragraph,
        $Hidden,
        [bool] $Supress = $true
    )
    if ($Paragraph -ne $null -and $Hidden -ne $null) {
        $Paragraph = $Paragraph.Hidden($Hidden)
    }
    if ($Supress) { return } else { return $Paragraph }
}

As you can see on screenshots... -Hidden is getting wrong color. I guess it's a special name but I still would like to use it.

Screenshots

image

image

Expected Behavior

No coloring?

Code Samples

TylerLeonhardt commented 6 years ago
Set-WordTextHidden -Hidden $Hidden -Surpress $false

Inline Github repro. I'm guessing because hidden is special for PowerShell classes

PrzemyslawKlys commented 6 years ago

@tylerl0706 Should I change it, or can I count on a fix?

omniomi commented 6 years ago

The eventual goal was to work out a proper class definition and make hidden only a keyword inside of it but that's a ways of. I will tweak the current match to look for nothing by whitespace between the beginning of the line and the word hidden which should cover 99% of cases for now.

There's nothing wrong with using -Hidden as a param and in fact the current match may trigger in other inappropriate instances.

Will fix.

Dictionary Ref: 296-303