Hashtable BareWord key highlighting changes with presence of inline comment
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Accessibilité débutants
- 48/100
- Type d'issue
- Bug
- Clarté
- Plutôt claire
- Activité
- À l'abandon
- Stack technique
- powershell
- Domaine
- tooling
Piste de recherche
Reproduce the issue in the PowerShell EditorSyntax repository using the provided hashtable and inline-comment example, comparing highlighting before and after saving. No source file or test is named in the report, so first locate the grammar or highlighting rules responsible for PowerShell hashtable keys and comments. Done means the key is highlighted consistently in both unsaved and saved editors.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
Prerequisites
- I have written a descriptive issue title.
- I have searched all open and closed issues to ensure it has not already been reported.
- I have read the troubleshooting guide.
- I am sure this issue is with the extension itself and does not reproduce in a standalone PowerShell instance.
- I have verified that I am using the latest version of Visual Studio Code and the PowerShell extension.
- If this is a security issue, I have read the security issue reporting guidance.
Summary
The syntax highlighting of a BareWord key that is followed by an inline comment in a Hashtable is different in a new unsaved editor vs when it is saved.
Before the file is saved:
After the file is saved:
Removing the inline comment (re-adding the inline comment goes back to how it is above):
I would expect the keys to be consistently highlighted, regardless of a following inline comment or not.
I'm using the Default Dark Modern theme - in case that's relevant.
Edit: I noticed while filling in this issue template, that GitHub's syntax highlighting also does the same thing!
The two key's are subtly different colours
PowerShell Version
Name Value
---- -----
PSVersion 7.4.12
PSEdition Core
GitCommitId 7.4.12
OS Microsoft Windows 10.0.22631
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Name : Visual Studio Code Host
Version : 2025.2.0
InstanceId : 703b8fce-f163-4396-8543-54cfa0a5ba7c
UI : System.Management.Automation.Internal.Host.InternalHostUserInterface
CurrentCulture : en-GB
CurrentUICulture : en-GB
PrivateData : Microsoft.PowerShell.ConsoleHost+ConsoleColorProxy
DebuggerEnabled : True
IsRunspacePushed : False
Runspace : System.Management.Automation.Runspaces.LocalRunspace
Visual Studio Code Version
1.104.2
e3a5acfb517a443235981655413d566533107e92
x64
Extension Version
ms-vscode.powershell@2025.2.0
Steps to Reproduce
Open a new file and paste in:
@{
Key1 <#Sneakycomment#> = "Value1"
Key2 = "Value2"
}
Note the highlighting.
Save the file.
Note the highlighting changes.
Remove the inline comment.
Visuals
No response
Logs
No response
- Langage dominant
- PowerShell
- Étoiles
- 151
- Forks
- 55
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de PowerShell/EditorSyntax
-
Difficulté 3/5 1-2 jours Accessibilité débutants 55/100
PowerShell/EditorSyntax#224 · 2 commentaires ·
-
Difficulté 3/5 1-2 jours Accessibilité débutants 48/100
PowerShell/EditorSyntax#222 · 2 commentaires ·
-
Difficulté 3/5 1-2 jours Accessibilité débutants 55/100
PowerShell/EditorSyntax#221 · 2 commentaires ·
-
Difficulté 3/5 1-2 jours Accessibilité débutants 45/100
PowerShell/EditorSyntax#220 · 2 commentaires · 1 réaction ·
-
Issue-Bug Needs: Triage :mag:
Difficulté 3/5 1-2 jours Accessibilité débutants 35/100
PowerShell/EditorSyntax#217 ·
Toutes les issues de PowerShell/EditorSyntax
Issues similaires
-
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
0xMiden/bridge-portal#132 ·
-
bug
Difficulté 2/5 1-3 heures Accessibilité débutants 84/100
newrelic-experimental/preflight#793 · 1 commentaire ·
-
enhancement
Difficulté 2/5 1-3 heures Accessibilité débutants 70/100
babalae/bettergi-scripts-list#3674 ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 88/100
caddyserver/caddy#8046 ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
zilliztech/memsearch#759 ·