diff --git a/internal/langserver/handlers/semantic_tokens_test.go b/internal/langserver/handlers/semantic_tokens_test.go index d86e073c3..5e3d0b559 100644 --- a/internal/langserver/handlers/semantic_tokens_test.go +++ b/internal/langserver/handlers/semantic_tokens_test.go @@ -71,7 +71,8 @@ func TestSemanticTokensFull(t *testing.T) { "tokenTypes": [ "type", "property", - "string" + "string", + "enumMember" ], "tokenModifiers": [ "deprecated", @@ -113,7 +114,7 @@ func TestSemanticTokensFull(t *testing.T) { "result": { "data": [ 0,0,8,0,0, - 0,9,6,1,2 + 0,9,6,3,2 ] } }`) @@ -178,7 +179,8 @@ func TestSemanticTokensFull_clientSupportsDelta(t *testing.T) { "tokenTypes": [ "type", "property", - "string" + "string", + "enumMember" ], "tokenModifiers": [ "deprecated", @@ -222,7 +224,7 @@ func TestSemanticTokensFull_clientSupportsDelta(t *testing.T) { "result": { "data": [ 0,0,8,0,0, - 0,9,6,1,2 + 0,9,6,3,2 ] } }`) diff --git a/internal/lsp/token_encoder.go b/internal/lsp/token_encoder.go index 6136f7a99..b2ef9085c 100644 --- a/internal/lsp/token_encoder.go +++ b/internal/lsp/token_encoder.go @@ -34,7 +34,7 @@ func (te *TokenEncoder) encodeTokenOfIndex(i int) []uint32 { case lang.TokenBlockType: tokenType = TokenTypeType case lang.TokenBlockLabel: - tokenType = TokenTypeString + tokenType = TokenTypeEnumMember case lang.TokenAttrName: tokenType = TokenTypeProperty case lang.TokenBool: diff --git a/internal/lsp/token_encoder_test.go b/internal/lsp/token_encoder_test.go index 8ecf8c67b..6070e6bf4 100644 --- a/internal/lsp/token_encoder_test.go +++ b/internal/lsp/token_encoder_test.go @@ -68,7 +68,7 @@ func TestTokenEncoder_singleLineTokens(t *testing.T) { data := te.Encode() expectedData := []uint32{ 0, 0, 7, 0, 0, - 0, 8, 8, 1, 0, + 0, 8, 8, 7, 0, 1, 2, 8, 2, 0, 1, 2, 8, 2, 0, 1, 2, 9, 2, 0, @@ -162,8 +162,8 @@ func TestTokenEncoder_deltaStartCharBug(t *testing.T) { data := te.Encode() expectedData := []uint32{ 0, 0, 8, 0, 0, - 0, 9, 21, 1, 2, - 0, 22, 20, 1, 0, + 0, 9, 21, 7, 2, + 0, 22, 20, 7, 0, } if diff := cmp.Diff(expectedData, data); diff != "" { @@ -243,7 +243,7 @@ func TestTokenEncoder_tokenModifiers(t *testing.T) { data := te.Encode() expectedData := []uint32{ 0, 0, 7, 0, 0, - 0, 8, 8, 1, 1, + 0, 8, 8, 7, 1, 1, 2, 8, 2, 1, 1, 2, 8, 2, 2, 1, 2, 9, 2, 3, diff --git a/internal/lsp/token_types.go b/internal/lsp/token_types.go index cfb8d4ace..f55410c0f 100644 --- a/internal/lsp/token_types.go +++ b/internal/lsp/token_types.go @@ -109,6 +109,7 @@ var ( TokenTypeNumber, TokenTypeParameter, TokenTypeVariable, + TokenTypeEnumMember, } serverTokenModifiers = TokenModifiers{ TokenModifierDeprecated,