1 # RUN: clangd -lit-test < %s | FileCheck -strict-whitespace %s -implicit-check-not=semanticHighlight
2 # Send capabilities for both Theia semanticHighlight & standard semanticTokens.
3 # clangd should not use/acknowledge the Theia protocol.
4 {"jsonrpc":"2.0","id":0,"method":"initialize","params":{"capabilities":{"textDocument":{
5 "semanticHighlightingCapabilities":{"semanticHighlighting":true},
6 "semanticTokens":{"dynamicRegistration":true}
9 {"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{
10 "uri": "test:///foo.cpp",
15 # Non-incremental token request.
16 {"jsonrpc":"2.0","id":1,"method":"textDocument/semanticTokens/full","params":{"textDocument":{"uri":"test:///foo.cpp"}}}
18 # CHECK-NEXT: "jsonrpc": "2.0",
19 # CHECK-NEXT: "result": {
20 # CHECK-NEXT: "data": [
21 # First line, char 5, variable, declaration+globalScope
28 # CHECK-NEXT: "resultId": "1"
31 {"jsonrpc":"2.0","method":"textDocument/didChange","params":{
32 "textDocument": {"uri":"test:///foo.cpp","version":2},
33 "contentChanges":[{"text":"int x = 2;\nint y = 3;"}]
36 # Incremental token request, based on previous response.
37 {"jsonrpc":"2.0","id":2,"method":"textDocument/semanticTokens/full/delta","params":{
38 "textDocument": {"uri":"test:///foo.cpp"},
39 "previousResultId": "1"
42 # CHECK-NEXT: "jsonrpc": "2.0",
43 # CHECK-NEXT: "result": {
44 # CHECK-NEXT: "edits": [
46 # CHECK-NEXT: "data": [
47 # Next line, char 5, variable, declaration+globalScope
54 # Inserted at position 1
55 # CHECK-NEXT: "deleteCount": 0,
56 # CHECK-NEXT: "start": 5
59 # CHECK-NEXT: "resultId": "2"
62 # Incremental token request with incorrect baseline => full tokens list.
63 {"jsonrpc":"2.0","id":2,"method":"textDocument/semanticTokens/full/delta","params":{
64 "textDocument": {"uri":"test:///foo.cpp"},
65 "previousResultId": "bogus"
68 # CHECK-NEXT: "jsonrpc": "2.0",
69 # CHECK-NEXT: "result": {
70 # CHECK-NEXT: "data": [
82 # CHECK-NEXT: "resultId": "3"
85 {"jsonrpc":"2.0","id":3,"method":"shutdown"}
87 {"jsonrpc":"2.0","method":"exit"}