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":{"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"}} 3--- 4{"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"test:///main.cpp","languageId":"cpp","version":1,"text":"void foo(); int main() { foo(); }\n"}}} 5--- 6{"jsonrpc":"2.0","id":1,"method":"workspace/symbol","params":{"query":"vector"}} 7# CHECK: "id": 1, 8# CHECK-NEXT: "jsonrpc": "2.0", 9# CHECK-NEXT: "result": [ 10# CHECK-NEXT: { 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": {{.*}} 18# CHECK-NEXT: }, 19# CHECK-NEXT: "start": { 20# CHECK-NEXT: "character": {{.*}}, 21# CHECK-NEXT: "line": {{.*}} 22# CHECK-NEXT: } 23# CHECK-NEXT: }, 24# CHECK-NEXT: "uri": "file://{{.*}}/vector.h" 25# CHECK-NEXT: }, 26# CHECK-NEXT: "name": "vector", 27# CHECK-NEXT: "score": {{.*}} 28# CHECK-NEXT: } 29# CHECK-NEXT: ] 30# CHECK-NEXT:} 31--- 32{"jsonrpc":"2.0","id":2,"method":"textDocument/documentSymbol","params":{"textDocument":{"uri":"test:///main.cpp"}}} 33# CHECK: "id": 2, 34# CHECK-NEXT: "jsonrpc": "2.0", 35# CHECK-NEXT: "result": [ 36# CHECK-NEXT: { 37# CHECK-NEXT: "containerName": "", 38# CHECK-NEXT: "kind": 12, 39# CHECK-NEXT: "location": { 40# CHECK-NEXT: "range": { 41# CHECK-NEXT: "end": { 42# CHECK-NEXT: "character": {{.*}}, 43# CHECK-NEXT: "line": {{.*}} 44# CHECK-NEXT: }, 45# CHECK-NEXT: "start": { 46# CHECK-NEXT: "character": {{.*}}, 47# CHECK-NEXT: "line": {{.*}} 48# CHECK-NEXT: } 49# CHECK-NEXT: }, 50# CHECK-NEXT: "uri": "file://{{.*}}/main.cpp" 51# CHECK-NEXT: }, 52# CHECK-NEXT: "name": "foo" 53# CHECK-NEXT: } 54# CHECK-NEXT: { 55# CHECK-NEXT: "containerName": "", 56# CHECK-NEXT: "kind": 12, 57# CHECK-NEXT: "location": { 58# CHECK-NEXT: "range": { 59# CHECK-NEXT: "end": { 60# CHECK-NEXT: "character": {{.*}}, 61# CHECK-NEXT: "line": {{.*}} 62# CHECK-NEXT: }, 63# CHECK-NEXT: "start": { 64# CHECK-NEXT: "character": {{.*}}, 65# CHECK-NEXT: "line": {{.*}} 66# CHECK-NEXT: } 67# CHECK-NEXT: }, 68# CHECK-NEXT: "uri": "file://{{.*}}/main.cpp" 69# CHECK-NEXT: }, 70# CHECK-NEXT: "name": "main" 71# CHECK-NEXT: } 72# CHECK-NEXT: ] 73# CHECK-NEXT:} 74--- 75{"jsonrpc":"2.0","id":3,"method":"textDocument/documentSymbol","params":{"textDocument":{"uri":"test:///foo.cpp"}}} 76# CHECK: "error": { 77# CHECK-NEXT: "code": -32602, 78# CHECK-NEXT: "message": "trying to get AST for non-added document" 79# CHECK-NEXT: }, 80# CHECK-NEXT: "id": 3, 81# CHECK-NEXT: "jsonrpc": "2.0" 82--- 83{"jsonrpc":"2.0","id":3,"method":"shutdown"} 84--- 85{"jsonrpc":"2.0","method":"exit"} 86