Vscode-powershell: Version v2021.2.2 syntax highlighting is "poor" compared to previous version

Created on 3 Mar 2021  路  10Comments  路  Source: PowerShell/vscode-powershell

Environment

  • Editor and Version (VS Code, Atom, Sublime): VSCode 1.53.2
  • Your primary theme: dark (default)

Issue Description

Since the new extension for PowerShell was installed, the highliting became very "poor". Almost everything is now in blue and before there was white and yellow. Now, it's difficult to identify things... it's impossible to see when a function is called on an object and also when we access an object member. And it's also difficult to identify function parameter tags...

Screenshots

image

Expected Behavior

Previous version of the extension
image

Code Samples

Here's the code that is on the screenshots

# Cr茅ation d'une connexion au serveur vRA pour acc茅der 脿 ses API REST
    $logHistory.addLineAndDisplay("Connecting to vRA...")
    $vra = [vRAAPI]::new($configVra.getConfigValue(@($targetEnv, "infra", "server")),
                         $targetTenant, 
                         $configVra.getConfigValue(@($targetEnv, "infra", $targetTenant, "user")),
                         $configVra.getConfigValue(@($targetEnv, "infra", $targetTenant, "password")))

    # Parcours de la liste des BG
    Foreach ($bg in $vra.getBGList() )
    {
        $logHistory.addLineAndDisplay(("Processing BG '{0}'..." -f $bg.name))

        $logHistory.addLineAndDisplay("> Getting VM List...")   

        $vmList = $vra.getBGItemList($bg, "Virtual Machine")

        $logHistory.addLineAndDisplay(("> {0} VMs found" -f $vmList.count))

        Foreach($vm in $vmList)
        {
            $logHistory.addLineAndDisplay((">> Processing VM '{0}'..." -f $vm.name))

            if(((getvRAObjectCustomPropValue -object $vm -customPropName $global:VRA_CUSTOM_PROP_VRA_BG_NAME) -ne $bg.name) -or 
                ((getvRAObjectCustomPropValue -object $vm -customPropName $global:VRA_CUSTOM_PROP_VRA_TENANT_NAME) -ne $targetTenant))
            {
                $logHistory.addLineAndDisplay("Values need to be updated")
            }

        }

    }

Area-Semantic Highlighting Issue-Discussion

Most helpful comment

You can disable it:

    "editor.semanticHighlighting.enabled": false,

All 10 comments

This is due to a change in the extension to use "semantic highlighting" in addition to (and on top of) the editor syntax provided by this repo. With the extension enabled, the highlighting scheme changes (and it appears to need some work). See some related discussion here: https://github.com/PowerShell/vscode-powershell/issues/3211

Please revert the previous syntax highlighting back or at least let us choose between the 2, after the update my code isn't readable. I tried all different kind of theme's but they are all broken now.

You can disable it:

    "editor.semanticHighlighting.enabled": false,

Thanks we will use this as the meta-issue for Semantic highlighting

Following is partial copy from deleted post on another site btw., current behavior is... AHH

Recently syntax highlighting of built in PowerShell symbols changed from blue to green.

Here is how it looked before:
enter image description here

Here is how it looks now:

enter image description here

It also messes up with non relevant coloring like $true or function keyword.

EDIT:

Sorry I missed workaround from @PrzemyslawKlys, but regardless this workaround should be default.

It would be nice to be able disable semantic highlighting for PowerShell only. Right now I had to disable it as l dont like the way it displayed PowerShell code, but then every time I switch to JavaScript or another language I have to turn it back on. Its annoying to have to keep doing this.

You can...

"[powershell]": {
    "editor.semanticHighlighting.enabled": false
}

You can...

"[powershell]": {
    "editor.semanticHighlighting.enabled": false
}

beautiful, thanks!

Uh, we pinned this as the meta issue. Re-opening...

Here's a solution without disabling semantic highlighting

I copied @LuluTchab 's screenshot for a comparison. I'm getting the diversity of the original. I'm using Dark+
image

If you're using a different theme, you can fix it:

    "editor.semanticTokenColorCustomizations": {
        // per-theme
        "[Default Dark+]": {
            "enabled": true,
            "rules": {
                "parameter": "#d4d4d4",
        }
    },

How to find token names

Run this command:
image

The token inspector will give you textmate scopes and semantic tokens

image

attach

Was this page helpful?
0 / 5 - 0 ratings

Related issues

keposet picture keposet  路  3Comments

lukegriffith picture lukegriffith  路  3Comments

itfranck picture itfranck  路  3Comments

guidooliveira picture guidooliveira  路  3Comments

timoline picture timoline  路  3Comments