| 1 |
# RUN: clangd -lit-test < %s | FileCheck -strict-whitespace %s |
| 2 |
{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"capabilities":{ |
| 3 |
"workspace":{"semanticTokens":{"refreshSupport":true}} |
| 4 |
}}} |
| 5 |
--- |
| 6 |
{"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{ |
| 7 |
"uri": "test:///foo.cpp", |
| 8 |
"languageId": "cpp", |
| 9 |
"text": "int x = 2;" |
| 10 |
}}} |
| 11 |
# Expect a request after initial preamble build. |
| 12 |
# CHECK: "method": "workspace/semanticTokens/refresh", |
| 13 |
# CHECK-NEXT: "params": null |
| 14 |
# CHECK-NEXT: } |
| 15 |
--- |
| 16 |
# Reply with success. |
| 17 |
{"jsonrpc":"2.0","id":0} |
| 18 |
--- |
| 19 |
# Preamble stays the same, no refresh requests. |
| 20 |
{"jsonrpc":"2.0","method":"textDocument/didChange","params":{ |
| 21 |
"textDocument": {"uri":"test:///foo.cpp","version":2}, |
| 22 |
"contentChanges":[{"text":"int x = 2;\nint y = 3;"}] |
| 23 |
}} |
| 24 |
# CHECK-NOT: "method": "workspace/semanticTokens/refresh" |
| 25 |
--- |
| 26 |
# Preamble changes |
| 27 |
{"jsonrpc":"2.0","method":"textDocument/didChange","params":{ |
| 28 |
"textDocument": {"uri":"test:///foo.cpp","version":2}, |
| 29 |
"contentChanges":[{"text":"#define FOO"}] |
| 30 |
}} |
| 31 |
# Expect a request after initial preamble build. |
| 32 |
# CHECK: "method": "workspace/semanticTokens/refresh", |
| 33 |
# CHECK-NEXT: "params": null |
| 34 |
# CHECK-NEXT: } |
| 35 |
--- |
| 36 |
# Reply with error, to make sure there are no crashes. |
| 37 |
{"jsonrpc":"2.0","id":1,"error":{"code": 0, "message": "msg"}} |
| 38 |
--- |
| 39 |
{"jsonrpc":"2.0","id":3,"method":"shutdown"} |
| 40 |
--- |
| 41 |
{"jsonrpc":"2.0","method":"exit"} |
| 42 |
|