From 2bb42806fe52a9ce4569aed8cdc097a8b1cd7124 Mon Sep 17 00:00:00 2001 From: MartinGC94 Date: Mon, 22 Jul 2024 23:04:45 +0200 Subject: [PATCH] Add new Decorator and Label semantic tokens for attributes and loop labels. Also removes the incorrect Generic -> Function mapping. --- .../TextDocument/Handlers/PsesSemanticTokensHandler.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/PowerShellEditorServices/Services/TextDocument/Handlers/PsesSemanticTokensHandler.cs b/src/PowerShellEditorServices/Services/TextDocument/Handlers/PsesSemanticTokensHandler.cs index e5e69e60fe..494843bb5a 100644 --- a/src/PowerShellEditorServices/Services/TextDocument/Handlers/PsesSemanticTokensHandler.cs +++ b/src/PowerShellEditorServices/Services/TextDocument/Handlers/PsesSemanticTokensHandler.cs @@ -108,6 +108,11 @@ private static SemanticTokenType MapSemanticTokenType(Token token) return SemanticTokenType.Operator; } + if ((token.TokenFlags & TokenFlags.AttributeName) != 0) + { + return SemanticTokenType.Decorator; + } + if ((token.TokenFlags & TokenFlags.TypeName) != 0) { return SemanticTokenType.Type; @@ -142,8 +147,8 @@ private static SemanticTokenType MapSemanticTokenType(Token token) case TokenKind.Number: return SemanticTokenType.Number; - case TokenKind.Generic: - return SemanticTokenType.Function; + case TokenKind.Label: + return SemanticTokenType.Label; } return null;