PowerShell / EditorSyntax

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

IntelliSense / Syntax highlighting not working properly in Insider 1.21.0 #66

Closed aeschli closed 6 years ago

aeschli commented 6 years ago

From @iricigor on February 16, 2018 10:17

Steps to Reproduce:

  1. Install VS Code
  2. Paste code below and change language settings to PowerShell

Does this issue occur when all extensions are disabled?: Yes

Installing PowerShell extension has no impact on behaviour

Code to paste

$p = get-process | select -first 1
$a = $p.Name -split '='
Write-Host $a

Expected result

Here is screenshot from stable VS Code 1.20.1 image Syntax highlighting is as expected. Notice command in last line.

Actual result

Here is screenshot from Insiders VS Code 1.21.0 image

Explanation

Notice again command in last line. It is not correctly colored now. Code itself is correct.

The actual problem is in previous line. Token '=' is not parsed properly (opening and closing apostrophes are not matching). The same thing happens also with quotation marks (i.e. "=" will be wrong), but also other spoecial characters instead of equal sign, like %, !, etc.

Furthermore, this happens only when there is a dot in the beggining of the same line. If code would be $a = $p -split '=' or if there would be another dot in the same line $a = $p.name -split '.', parsing would be fine.

Copied from original issue: Microsoft/vscode#43816

iricigor commented 6 years ago

Just to understand this move of the issue. VS Code 1.21 is using PowerShell/EditorSyntax, and version 1.20 is not using it. Is that correct?

I don't see recent updates in PowerShell/EditorSyntax, so VS Code was not broken by an update in this repo.

aeschli commented 6 years ago

Yes, correct, the latest 1.21-insider builds are now using the grammar from PowerShell/EditorSyntax. This fixed some issues, but there will be some new issues that come to light.

daviwil commented 6 years ago

Hey Martin, I think this change shouldn't have been made yet. We. Used this grammar once before in VS Code but had to pull it back out due to the many issues that it has. @gravejester has been working on a totally revamped version but it hasn't been merged yet. I apologize for not mentioning this sooner but I haven't been able to keep a close eye on these projects since I left Microsoft. Let me know if you have any questions!

aeschli commented 6 years ago

@daviwil Would you mind hosting the 'old' grammar in a separate repository (or in PowerShell/EditorSyntax)? We want these grammars to be available also for other editors and want a place to move the issues to.

daviwil commented 6 years ago

@aeschli PR #68 will move this repo back to VS Code's version of the grammar until V2 is done.

aeschli commented 6 years ago

@daviwil Great, thanks a lot!

aeschli commented 6 years ago

@daviwil I updated the Powershell to the latest from this repo. That means we are back to what we had in 1.20 and this bug is fixed.