Skip to content

Commit

Permalink
internal/lsp: sort supported token types & modifiers
Browse files Browse the repository at this point in the history
  • Loading branch information
radeksimko committed Mar 4, 2022
1 parent d42d5e7 commit e2385c7
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 42 deletions.
30 changes: 15 additions & 15 deletions internal/langserver/handlers/semantic_tokens_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,14 @@ func TestSemanticTokensFull(t *testing.T) {
"textDocument": {
"semanticTokens": {
"tokenTypes": [
"type",
"enumMember",
"property",
"string",
"enumMember"
"type"
],
"tokenModifiers": [
"deprecated",
"defaultLibrary"
"defaultLibrary",
"deprecated"
],
"requests": {
"full": true
Expand Down Expand Up @@ -113,8 +113,8 @@ func TestSemanticTokensFull(t *testing.T) {
"id": 3,
"result": {
"data": [
0,0,8,0,0,
0,9,6,3,2
0,0,8,3,0,
0,9,6,0,1
]
}
}`)
Expand Down Expand Up @@ -177,14 +177,14 @@ func TestSemanticTokensFull_clientSupportsDelta(t *testing.T) {
"textDocument": {
"semanticTokens": {
"tokenTypes": [
"type",
"enumMember",
"property",
"string",
"enumMember"
"type"
],
"tokenModifiers": [
"deprecated",
"defaultLibrary"
"defaultLibrary",
"deprecated"
],
"requests": {
"full": {
Expand Down Expand Up @@ -223,8 +223,8 @@ func TestSemanticTokensFull_clientSupportsDelta(t *testing.T) {
"id": 3,
"result": {
"data": [
0,0,8,0,0,
0,9,6,3,2
0,0,8,3,0,
0,9,6,0,1
]
}
}`)
Expand Down Expand Up @@ -292,8 +292,8 @@ func TestVarsSemanticTokensFull(t *testing.T) {
"string"
],
"tokenModifiers": [
"deprecated",
"defaultLibrary"
"defaultLibrary",
"deprecated"
],
"requests": {
"full": true
Expand Down Expand Up @@ -340,7 +340,7 @@ func TestVarsSemanticTokensFull(t *testing.T) {
"id": 4,
"result": {
"data": [
0,0,4,2,0,
0,0,4,0,0,
0,7,5,1,0
]
}
Expand Down
42 changes: 21 additions & 21 deletions internal/lsp/token_encoder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@ func TestTokenEncoder_singleLineTokens(t *testing.T) {
}
data := te.Encode()
expectedData := []uint32{
0, 0, 7, 0, 0,
0, 8, 8, 7, 0,
1, 2, 8, 2, 0,
1, 2, 8, 2, 0,
1, 2, 9, 2, 0,
0, 0, 7, 7, 0,
0, 8, 8, 0, 0,
1, 2, 8, 5, 0,
1, 2, 8, 5, 0,
1, 2, 9, 5, 0,
}

if diff := cmp.Diff(expectedData, data); diff != "" {
Expand Down Expand Up @@ -124,7 +124,7 @@ func TestTokenEncoder_unknownTokenType(t *testing.T) {
}
data := te.Encode()
expectedData := []uint32{
2, 2, 7, 2, 0,
2, 2, 7, 5, 0,
}

if diff := cmp.Diff(expectedData, data); diff != "" {
Expand Down Expand Up @@ -161,9 +161,9 @@ func TestTokenEncoder_multiLineTokens(t *testing.T) {
}
data := te.Encode()
expectedData := []uint32{
1, 2, 24, 2, 0,
1, 0, 15, 2, 0,
1, 0, 11, 2, 0,
1, 2, 24, 5, 0,
1, 0, 15, 5, 0,
1, 0, 11, 5, 0,
}

if diff := cmp.Diff(expectedData, data); diff != "" {
Expand Down Expand Up @@ -214,9 +214,9 @@ func TestTokenEncoder_deltaStartCharBug(t *testing.T) {
}
data := te.Encode()
expectedData := []uint32{
0, 0, 8, 0, 0,
0, 9, 21, 7, 2,
0, 22, 20, 7, 0,
0, 0, 8, 7, 0,
0, 9, 21, 0, 1,
0, 22, 20, 0, 0,
}

if diff := cmp.Diff(expectedData, data); diff != "" {
Expand Down Expand Up @@ -295,11 +295,11 @@ func TestTokenEncoder_tokenModifiers(t *testing.T) {
}
data := te.Encode()
expectedData := []uint32{
0, 0, 7, 0, 0,
0, 8, 8, 7, 1,
1, 2, 8, 2, 1,
1, 2, 8, 2, 2,
1, 2, 9, 2, 3,
0, 0, 7, 7, 0,
0, 8, 8, 0, 2,
1, 2, 8, 5, 2,
1, 2, 8, 5, 1,
1, 2, 9, 5, 3,
}

if diff := cmp.Diff(expectedData, data); diff != "" {
Expand Down Expand Up @@ -378,10 +378,10 @@ func TestTokenEncoder_unsupported(t *testing.T) {
}
data := te.Encode()
expectedData := []uint32{
0, 0, 7, 0, 0,
1, 2, 8, 1, 1,
1, 2, 8, 1, 0,
1, 2, 9, 1, 1,
0, 0, 7, 1, 0,
1, 2, 8, 0, 1,
1, 2, 8, 0, 0,
1, 2, 9, 0, 1,
}

if diff := cmp.Diff(expectedData, data); diff != "" {
Expand Down
12 changes: 6 additions & 6 deletions internal/lsp/token_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,19 +102,19 @@ const (
// to be registered by VS Code by default, see https://git.io/JIeuV
var (
serverTokenTypes = TokenTypes{
TokenTypeType,
TokenTypeString,
TokenTypeProperty,
TokenTypeEnumMember,
TokenTypeFunction,
TokenTypeKeyword,
TokenTypeNumber,
TokenTypeParameter,
TokenTypeProperty,
TokenTypeString,
TokenTypeType,
TokenTypeVariable,
TokenTypeEnumMember,
TokenTypeFunction,
}
serverTokenModifiers = TokenModifiers{
TokenModifierDeprecated,
TokenModifierDefaultLibrary,
TokenModifierDeprecated,
}
)

Expand Down

0 comments on commit e2385c7

Please sign in to comment.