From 50506576b8a6cec06115896c3f09e76d47eb86b0 Mon Sep 17 00:00:00 2001 From: pjw Date: Sun, 6 Nov 2022 11:06:43 -0500 Subject: [PATCH] gopls/fake: add semantic token modifiers to fake editor This change will make it possible to do semantic token regtests. Change-Id: I9963c60f61af30f973a2ee4cd32aaa5545bdc4ec Reviewed-on: https://go-review.googlesource.com/c/tools/+/448296 TryBot-Result: Gopher Robot Run-TryBot: Peter Weinberger Reviewed-by: Robert Findley gopls-CI: kokoro --- gopls/internal/lsp/fake/editor.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gopls/internal/lsp/fake/editor.go b/gopls/internal/lsp/fake/editor.go index dfd17c7e55a..f73301d674c 100644 --- a/gopls/internal/lsp/fake/editor.go +++ b/gopls/internal/lsp/fake/editor.go @@ -265,6 +265,10 @@ func (e *Editor) initialize(ctx context.Context) error { "event", "function", "method", "macro", "keyword", "modifier", "comment", "string", "number", "regexp", "operator", } + params.Capabilities.TextDocument.SemanticTokens.TokenModifiers = []string{ + "declaration", "definition", "readonly", "static", + "deprecated", "abstract", "async", "modification", "documentation", "defaultLibrary", + } // This is a bit of a hack, since the fake editor doesn't actually support // watching changed files that match a specific glob pattern. However, the