| 1 |
This test checks the output of textDocument/semanticTokens/range. |
| 2 |
|
| 3 |
TODO: add more assertions. |
| 4 |
|
| 5 |
-- settings.json -- |
| 6 |
{ |
| 7 |
"semanticTokens": true |
| 8 |
} |
| 9 |
|
| 10 |
-- a.go -- |
| 11 |
package p //@token("package", "keyword", "") |
| 12 |
|
| 13 |
const C = 42 //@token("C", "variable", "definition readonly number") |
| 14 |
|
| 15 |
func F() { //@token("F", "function", "definition signature") |
| 16 |
x := 2 + 3//@token("x", "variable", "definition number"),token("2", "number", ""),token("+", "operator", "") |
| 17 |
_ = x //@token("x", "variable", "number") |
| 18 |
_ = F //@token("F", "function", "signature") |
| 19 |
} |
| 20 |
|
| 21 |
func _() { |
| 22 |
// A goto's label cannot be found by ascending the syntax tree. |
| 23 |
goto loop //@ token("goto", "keyword", ""), token("loop", "label", "") |
| 24 |
|
| 25 |
loop: //@token("loop", "label", "definition") |
| 26 |
for { |
| 27 |
continue loop //@ token("continue", "keyword", ""), token("loop", "label", "") |
| 28 |
} |
| 29 |
} |