PowerShell / EditorSyntax

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

Comma and Periods break Highlighting inside of Quotes. #14

Closed gerane closed 6 years ago

gerane commented 8 years ago

This just started happening in the latest Code Insiders 7/27

Sample Code

if ($ModuleResults)
{
    if ($ModuleResults.Installed -ne $null)
    {
        Write-Host "[INFO] " -ForegroundColor DarkMagenta -NoNewline
        Write-Host "Installed Modules: "  -NoNewLine -ForegroundColor Gray 
        Write-Host "$($ModuleResults.Installed -join ', ')" -ForegroundColor DarkGray
    }

    if ($ModuleResults.Updated -ne $null)
    {
        Write-Host "[INFO] " -ForegroundColor DarkMagenta -NoNewline
        Write-Host "Updated Modules: " -NoNewLine -ForegroundColor Gray 
        Write-Host "$($ModuleResults.Updated -join ', ')" -ForegroundColor DarkGray
    }

    if ($ModuleResults.FailedUpdate -ne $null)
    {
        Write-Host "[Error] " -ForegroundColor Red -NoNewline
        Write-Host "Module Update Failed: " -NoNewLine -ForegroundColor Gray 
        Write-Host "$($ModuleResults.FailedUpdate -join ', ')" -ForegroundColor DarkGray
    }

    if ($ModuleResults.FailedInstall -ne $null)
    {
        Write-Host "[ERROR] " -ForegroundColor Red -NoNewline
        Write-Host "Module Install Failed: " -NoNewLine -ForegroundColor Gray 
        Write-Host "$($ModuleResults.FailedInstall -join ', ')" -ForegroundColor DarkGray
    }
}

Here is how it looks by default

syntaxquotes

If I remove the dot in $ModuleResults.Installed it clears up.

syntaxnoperiod

If I remove the comma inside of the quotes, you can see that it clears up the rest of the syntax outside of the double quotes, but the -join ' ' is still wrong.

syntaxnocomma

Removing the double quotes still has all following syntax broken.

syntaxnodouble

omniomi commented 6 years ago

Fixed by #94