Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version v2021.2.2 syntax highlighting is "poor" compared to previous version #3221

Closed
LuluTchab opened this issue Mar 3, 2021 · 10 comments · Fixed by #3377
Closed

Version v2021.2.2 syntax highlighting is "poor" compared to previous version #3221

LuluTchab opened this issue Mar 3, 2021 · 10 comments · Fixed by #3377

Comments

@LuluTchab
Copy link

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")
			}

        }

    }
@andyleejordan
Copy link
Member

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: #3211

@andyleejordan andyleejordan transferred this issue from PowerShell/EditorSyntax Mar 3, 2021
@ghost ghost added the Needs: Triage Maintainer attention needed! label Mar 3, 2021
@rudesome
Copy link

rudesome commented Mar 4, 2021

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.

@PrzemyslawKlys
Copy link
Contributor

You can disable it:

    "editor.semanticHighlighting.enabled": false,

@SydneyhSmith
Copy link
Collaborator

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

@metablaster
Copy link

metablaster commented Mar 31, 2021

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.

@ghost ghost added the Needs: Maintainer Attention Maintainer attention needed! label Mar 31, 2021
@MMAgeek
Copy link

MMAgeek commented Apr 1, 2021

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.

@PrzemyslawKlys
Copy link
Contributor

You can...


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

@rudesome
Copy link

rudesome commented Apr 1, 2021

You can...


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

beautiful, thanks!

@ghost ghost closed this as completed Apr 2, 2021
@andyleejordan andyleejordan removed the Resolution-Answered Will close automatically. label Apr 6, 2021
@andyleejordan
Copy link
Member

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

@andyleejordan andyleejordan reopened this Apr 6, 2021
@ninmonkey
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants