1 # RUN: clangd --index-file=%S/Inputs/symbols.test.yaml -lit-test < %s | FileCheck %s
2 {"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":123,"rootPath":"clangd","capabilities":{"textDocument":{"documentSymbol":{"hierarchicalDocumentSymbolSupport":true}},"workspace":{"symbol":{"symbolKind":{"valueSet": [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26]}}}},"trace":"off"}}
4 {"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"test:///main.cpp","languageId":"cpp","version":1,"text":"void foo(); int main() { foo(); }\n"}}}
6 {"jsonrpc":"2.0","id":1,"method":"workspace/symbol","params":{"query":"vector"}}
8 # CHECK-NEXT: "jsonrpc": "2.0",
9 # CHECK-NEXT: "result": [
11 # CHECK-NEXT: "containerName": "std",
12 # CHECK-NEXT: "kind": 5,
13 # CHECK-NEXT: "location": {
14 # CHECK-NEXT: "range": {
15 # CHECK-NEXT: "end": {
16 # CHECK-NEXT: "character": {{.*}},
17 # CHECK-NEXT: "line": {{.*}}
19 # CHECK-NEXT: "start": {
20 # CHECK-NEXT: "character": {{.*}},
21 # CHECK-NEXT: "line": {{.*}}
24 # CHECK-NEXT: "uri": "file://{{.*}}/vector.h"
26 # CHECK-NEXT: "name": "vector",
27 # CHECK-NEXT: "score": {{.*}}
32 {"jsonrpc":"2.0","id":2,"method":"textDocument/documentSymbol","params":{"textDocument":{"uri":"test:///main.cpp"}}}
34 # CHECK-NEXT: "jsonrpc": "2.0",
35 # CHECK-NEXT: "result": [
37 # CHECK-NEXT: "detail": "void ()",
38 # CHECK-NEXT: "kind": 12,
39 # CHECK-NEXT: "name": "foo",
40 # CHECK-NEXT: "range": {
41 # CHECK-NEXT: "end": {
42 # CHECK-NEXT: "character": {{.*}},
43 # CHECK-NEXT: "line": {{.*}}
45 # CHECK-NEXT: "start": {
46 # CHECK-NEXT: "character": {{.*}},
47 # CHECK-NEXT: "line": {{.*}}
50 # CHECK-NEXT: "selectionRange": {
51 # CHECK-NEXT: "end": {
52 # CHECK-NEXT: "character": {{.*}},
53 # CHECK-NEXT: "line": {{.*}}
55 # CHECK-NEXT: "start": {
56 # CHECK-NEXT: "character": {{.*}},
57 # CHECK-NEXT: "line": {{.*}}
62 # CHECK-NEXT: "detail": "int ()",
63 # CHECK-NEXT: "kind": 12,
64 # CHECK-NEXT: "name": "main",
65 # CHECK-NEXT: "range": {
66 # CHECK-NEXT: "end": {
67 # CHECK-NEXT: "character": {{.*}},
68 # CHECK-NEXT: "line": {{.*}}
70 # CHECK-NEXT: "start": {
71 # CHECK-NEXT: "character": {{.*}},
72 # CHECK-NEXT: "line": {{.*}}
75 # CHECK-NEXT: "selectionRange": {
76 # CHECK-NEXT: "end": {
77 # CHECK-NEXT: "character": {{.*}},
78 # CHECK-NEXT: "line": {{.*}}
80 # CHECK-NEXT: "start": {
81 # CHECK-NEXT: "character": {{.*}},
82 # CHECK-NEXT: "line": {{.*}}
89 {"jsonrpc":"2.0","id":3,"method":"textDocument/documentSymbol","params":{"textDocument":{"uri":"test:///foo.cpp"}}}
91 # CHECK-NEXT: "code": -32602,
92 # CHECK-NEXT: "message": "trying to get AST for non-added document"
94 # CHECK-NEXT: "id": 3,
95 # CHECK-NEXT: "jsonrpc": "2.0"
97 {"jsonrpc":"2.0","id":3,"method":"shutdown"}
99 {"jsonrpc":"2.0","method":"exit"}