[mlir][sparse] implement non-permutation MapRef encoding (#69406)
[llvm-project.git] / clang-tools-extra / clangd / test / semantic-tokens.test
blobe5e8b749caeb3c2be9c23043965790efb4d5f29f
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}
7 }}}}
8 ---
9 {"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{
10   "uri": "test:///foo.cpp",
11   "languageId": "cpp",
12   "text": "int x = 2;"
13 }}}
14 ---
15 # Non-incremental token request.
16 {"jsonrpc":"2.0","id":1,"method":"textDocument/semanticTokens/full","params":{"textDocument":{"uri":"test:///foo.cpp"}}}
17 # CHECK:       "id": 1,
18 # CHECK-NEXT:  "jsonrpc": "2.0",
19 # CHECK-NEXT:  "result": {
20 # CHECK-NEXT:    "data": [
21 #                  First line, char 5, variable, declaration+globalScope
22 # CHECK-NEXT:      0,
23 # CHECK-NEXT:      4,
24 # CHECK-NEXT:      1,
25 # CHECK-NEXT:      0,
26 # CHECK-NEXT:      131075
27 # CHECK-NEXT:    ],
28 # CHECK-NEXT:    "resultId": "1"
29 # CHECK-NEXT:  }
30 ---
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;"}]
35 ---
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"
41 # CHECK:       "id": 2,
42 # CHECK-NEXT:  "jsonrpc": "2.0",
43 # CHECK-NEXT:  "result": {
44 # CHECK-NEXT:    "edits": [
45 # CHECK-NEXT:      {
46 # CHECK-NEXT:        "data": [
47 #                      Next line, char 5, variable, declaration+globalScope
48 # CHECK-NEXT:          1,
49 # CHECK-NEXT:          4,
50 # CHECK-NEXT:          1,
51 # CHECK-NEXT:          0,
52 # CHECK-NEXT:          131075
53 # CHECK-NEXT:        ],
54 #                    Inserted at position 1
55 # CHECK-NEXT:        "deleteCount": 0,
56 # CHECK-NEXT:        "start": 5
57 # CHECK-NEXT:      }
58 # CHECK-NEXT:    ],
59 # CHECK-NEXT:    "resultId": "2"
60 # CHECK-NEXT:  }
61 ---
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"
67 # CHECK:       "id": 2,
68 # CHECK-NEXT:  "jsonrpc": "2.0",
69 # CHECK-NEXT:  "result": {
70 # CHECK-NEXT:    "data": [
71 # CHECK-NEXT:      0,
72 # CHECK-NEXT:      4,
73 # CHECK-NEXT:      1,
74 # CHECK-NEXT:      0,
75 # CHECK-NEXT:      131075,
76 # CHECK-NEXT:      1,
77 # CHECK-NEXT:      4,
78 # CHECK-NEXT:      1,
79 # CHECK-NEXT:      0,
80 # CHECK-NEXT:      131075
81 # CHECK-NEXT:    ],
82 # CHECK-NEXT:    "resultId": "3"
83 # CHECK-NEXT:  }
84 ---
85 {"jsonrpc":"2.0","id":3,"method":"shutdown"}
86 ---
87 {"jsonrpc":"2.0","method":"exit"}