Skip to content

Commit

Permalink
change block label type to enum member (#802)
Browse files Browse the repository at this point in the history
  • Loading branch information
dbanck authored Feb 23, 2022
1 parent 81705b2 commit 8fcf43c
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
10 changes: 6 additions & 4 deletions internal/langserver/handlers/semantic_tokens_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ func TestSemanticTokensFull(t *testing.T) {
"tokenTypes": [
"type",
"property",
"string"
"string",
"enumMember"
],
"tokenModifiers": [
"deprecated",
Expand Down Expand Up @@ -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
]
}
}`)
Expand Down Expand Up @@ -178,7 +179,8 @@ func TestSemanticTokensFull_clientSupportsDelta(t *testing.T) {
"tokenTypes": [
"type",
"property",
"string"
"string",
"enumMember"
],
"tokenModifiers": [
"deprecated",
Expand Down Expand Up @@ -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
]
}
}`)
Expand Down
2 changes: 1 addition & 1 deletion internal/lsp/token_encoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
8 changes: 4 additions & 4 deletions internal/lsp/token_encoder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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 != "" {
Expand Down Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions internal/lsp/token_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ var (
TokenTypeNumber,
TokenTypeParameter,
TokenTypeVariable,
TokenTypeEnumMember,
}
serverTokenModifiers = TokenModifiers{
TokenModifierDeprecated,
Expand Down

0 comments on commit 8fcf43c

Please sign in to comment.