Debian Codegraph @

llvm-project/clang-tools-extra/clangd/test/Inputs/background-index/definition.jsonrpc.tmpl

raw
1 {
2 "jsonrpc": "2.0",
3 "id": 0,
4 "method": "initialize",
5 "params": {
6 "processId": 123,
7 "rootPath": "clangd",
8 "capabilities": { "window": { "workDoneProgress": true, "implicitWorkDoneProgressCreate": true} },
9 "trace": "off"
10 }
11 }
12 ---
13 {
14 "jsonrpc": "2.0",
15 "method": "textDocument/didOpen",
16 "params": {
17 "textDocument": {
18 "uri": "file://DIRECTORY/bar.cpp",
19 "languageId": "cpp",
20 "version": 1,
21 "text": "#include \"sub_dir/foo.h\"\nint main(){\nreturn foo();\n}"
22 }
23 }
24 }
25 # BUILD: "method": "$/progress"
26 # BUILD-NEXT: "params": {
27 # BUILD-NEXT: "token": "backgroundIndexProgress",
28 # BUILD-NEXT: "value": {
29 # BUILD-NEXT: "kind": "begin",
30 # BUILD-NEXT: "percentage": 0,
31 # BUILD-NEXT: "title": "indexing"
32 # BUILD-NEXT: }
33 # BUILD-NEXT: }
34 # BUILD: "method": "$/progress"
35 # BUILD-NEXT: "params": {
36 # BUILD-NEXT: "token": "backgroundIndexProgress",
37 # BUILD-NEXT: "value": {
38 # BUILD-NEXT: "kind": "report",
39 # BUILD-NEXT: "message": "0/1",
40 # BUILD-NEXT: "percentage": 0
41 # BUILD-NEXT: }
42 # BUILD-NEXT: }
43 # later...
44 # BUILD: "message": "1/2",
45 # BUILD-NEXT: "percentage": 50
46 # finally...
47 # BUILD: "kind": "end"
48 # when using the index, we spawn one task to read it, but not more.
49 # USE-NOT: "message": "1/2",
50 ---
51 {
52 "jsonrpc": "2.0",
53 "id": 1,
54 "method": "sync",
55 "params": null
56 }
57 ---
58 {
59 "jsonrpc": "2.0",
60 "id": 2,
61 "method": "textDocument/definition",
62 "params": {
63 "textDocument": {
64 "uri": "file://DIRECTORY/bar.cpp"
65 },
66 "position": {
67 "line": 2,
68 "character": 8
69 }
70 }
71 }
72 # CHECK: "uri": "file://{{.*}}/foo.cpp"
73 ---
74 {"jsonrpc":"2.0","id":3,"method":"shutdown"}
75 ---
76 {"jsonrpc":"2.0","method":"exit"}