Skip to content

Fix PowerShell highlighting of built-in constant variables - #223

Merged
Andy Jordan (andyleejordan) merged 1 commit into
PowerShell:mainfrom
o-l-a-v:fix/powershell-highlight-constant-built-in-variables
Apr 22, 2026
Merged

Andy Jordan (andyleejordan) merged 1 commit into
PowerShell:mainfrom
o-l-a-v:fix/powershell-highlight-constant-built-in-variables

Conversation

@o-l-a-v

@o-l-a-v Olav Rønnestad Birkeland (o-l-a-v) commented Mar 1, 2026 •

Copy link
Copy Markdown
Contributor

Related VSCode PR: microsoft/vscode#298570

PR Summary

Use a TextMate scope for PowerShell built-in constant variables that most themes actually have defined in tokenColors.

I see that C#, Ruby and Go TextMate files uses variable.other.constant.<language>, so I went with that.

PR Context

For a long time, PowerShell highlighting for built-in constant variables has been broken in VSCode.

image

Some related issues:

I believe I've tracked it down to the PowerShell TextMate using a TextMate scope most themes does not have a definition for:

image

The official Dracula theme even have a workaround just for this https://github.com/dracula/visual-studio-code/blob/main/src/dracula.yml:

  - name: Powershell constants mistakenly scoped to `support`, rather than `constant` (edge)
    scope:
    - support.constant
    settings:
      fontStyle: normal
      foreground: *PURPLE

@o-l-a-v

Olav Rønnestad Birkeland (o-l-a-v) commented Mar 3, 2026 •

Copy link
Copy Markdown
Contributor Author

Andy Jordan (@andyleejordan): Who can review this PR? Would be good to finally have highlighting of built-in constants working.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, sorry to have missed the ping! We've been a bit overwhelmed. This looks like a great fix, I'll merge it. Thanks!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants