First batch of syntax highlighting fixes for VS Code live in Insiders & link to next batch.

Good morning!

The first wave of fixes to the Visual Studio Code syntax highlighting of PowerShell are live in the insiders build as of today https://code.visualstudio.com/insiders/ and will appear in the next release of VS Code proper. The fixes now available in the insiders build include:

  • Proper highlighting of numbers including hex, scientific notation, and integers as well as positive/negative markers.
  • When you call a splat variables Get-Something @Splatting it will now highlight like a regular variable.
  • The sort keyword highlights correctly.
  • Cmdlets that start with approved verbs like Build and Deploy will now highlight correctly.
  • tee-object now highlights correctly.
  • .EXTERNALHELP, .FORWARDHELPCATEGORY, .FORWARDHELPTARGETNAME, .REMOTEHELPRUNSPACE, and .ROLE now marked correctly in comment based help.
  • The #requires statement now highlights correctly.
  • The using statement now highlights correctly.
  • hidden and static inside classes now highlight correctly.
  • Key names insides hashtables that match keywords in other constructs like From or Where will no longer highlight differently from other keys inside the hashtable.
  • Scriptblocks within hashtables now highlight consistently.
  • Parameter names that match keywords (like “Function”: Get-Command -CommandType Function) no longer highlight as if they were keywords.

If you would prefer to install this batch of changes in your regular install of VS Code ahead of the release instead of downloading the Insiders version you can download the latest build of the master branch here: https://ci.appveyor.com/project/powershell/editorsyntax/branch/master/artifacts. Place the json file over the one in <VS Code Install Directory>resourcesappextensionspowershellsyntaxes and reload VS Code.

Special thanks to: /u/bukem for his contributions, @TylerLeonhardt for doing the reviews and merges, and everyone who suggested bugs in this thread.

Unreleased Preview

If you would like to test the next batch of changes that isn’t even released to the Insiders branch of VS Code yet you can download the latest artifact from here: https://ci.appveyor.com/project/PowerShell/editorsyntax/build/1.0.43-qkysnyib/artifacts. Place the json file over the one in <VS Code Install Directory>resourcesappextensionspowershellsyntaxes and reload VS Code.

This file includes fixes for (+ the ones above):

  • Multiple bugs in highlighting within attributes like [ValidatePattern()] and [ValidateScript()].
    • Fixes document breaking issues caused by characters in things like regex patterns.
    • Fixes cmdlets not highlighting after the dash (only the Test in Test-Connection being highlighted.)
    • Fixes differences in bracket placement breaking highlighting.
    • Fixes certain comment placements breaking highlighting.
    • Fixes certain spacing between parameters, the =, and the value breaking highlighting.
    • Fixes if/else and try/catch statement highlighting issues that sometimes occurred in ValidateScript.
    • Various other improvements.
  • Type names that include digits no longer highlight inconsistently ([Int32], [X509Certificate], etc.)
  • Comments placed between function invocation and K&R style braces now highlight correctly.
  • --% in binary invocations now highlights as a keyword instead of a math operator and a foreach token.
  • The default keyword in switch statements now highlights correctly.
  • Various changes made for consistency (brackets, braces, parentheses are now consistently coloured, etc.)

There are also various changes to the scopes assigned to different elements so you may notice a difference in the way your favourite themes colour certain elements which should now be more consistent with other languages.

This version will be available in the Insiders build of VS Code in the next few days if you do not want to download manually. When it will appear in the full version I am not certain.

Sneak peek

Here’s a little sneak preview of the ‘Dark Console, Dark Editor’ theme from ISE ported to VS Code made easier by the new changes: https://i.imgur.com/JE4oSFV.png

There’s still lots of work to be done so please continue to report bugs and issues!

submitted by /u/omers
[link] [comments]

Leave a Reply