1 # RUN: clangd -lit-test < %s | FileCheck -strict-whitespace %s
2 {"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":123,"rootPath":"clangd","capabilities":{},"trace":"off"}}
4 {"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"test:///main.cpp","languageId":"cpp","version":1,"text":"struct Parent {};\nstruct Child1 : Parent {};\nstruct Child2 : Child1 {};\nstruct Child3 : Child2 {};\nstruct Child4 : Child3 {};"}}}
6 {"jsonrpc":"2.0","id":1,"method":"textDocument/typeHierarchy","params":{"textDocument":{"uri":"test:///main.cpp"},"position":{"line":2,"character":11},"direction":2,"resolve":1}}
8 # CHECK-NEXT: "jsonrpc": "2.0",
9 # CHECK-NEXT: "result": {
10 # CHECK-NEXT: "children": [
12 # CHECK-NEXT: "data": {
13 # CHECK-NEXT: "symbolID": "A6576FE083F2949A"
15 # CHECK-NEXT: "kind": 23,
16 # CHECK-NEXT: "name": "Child3",
17 # CHECK-NEXT: "range": {
18 # CHECK-NEXT: "end": {
19 # CHECK-NEXT: "character": 13,
20 # CHECK-NEXT: "line": 3
22 # CHECK-NEXT: "start": {
23 # CHECK-NEXT: "character": 7,
24 # CHECK-NEXT: "line": 3
27 # CHECK-NEXT: "selectionRange": {
28 # CHECK-NEXT: "end": {
29 # CHECK-NEXT: "character": 13,
30 # CHECK-NEXT: "line": 3
32 # CHECK-NEXT: "start": {
33 # CHECK-NEXT: "character": 7,
34 # CHECK-NEXT: "line": 3
37 # CHECK-NEXT: "uri": "file://{{.*}}/clangd-test/main.cpp"
40 # CHECK-NEXT: "data": {
41 # CHECK-NEXT: "parents": [
43 # CHECK-NEXT: "parents": [
45 # CHECK-NEXT: "parents": [],
46 # CHECK-NEXT: "symbolID": "FE546E7B648D69A7"
49 # CHECK-NEXT: "symbolID": "ECDC0C46D75120F4"
52 # CHECK-NEXT: "symbolID": "8A991335E4E67D08"
54 # CHECK-NEXT: "kind": 23,
55 # CHECK-NEXT: "name": "Child2",
56 # CHECK-NEXT: "parents": [
58 # CHECK-NEXT: "data": {
59 # CHECK-NEXT: "parents": [
61 # CHECK-NEXT: "parents": [],
62 # CHECK-NEXT: "symbolID": "FE546E7B648D69A7"
65 # CHECK-NEXT: "symbolID": "ECDC0C46D75120F4"
67 # CHECK-NEXT: "kind": 23,
68 # CHECK-NEXT: "name": "Child1",
69 # CHECK-NEXT: "parents": [
71 # CHECK-NEXT: "data": {
72 # CHECK-NEXT: "parents": [],
73 # CHECK-NEXT: "symbolID": "FE546E7B648D69A7"
75 # CHECK-NEXT: "kind": 23,
76 # CHECK-NEXT: "name": "Parent",
77 # CHECK-NEXT: "parents": [],
78 # CHECK-NEXT: "range": {
79 # CHECK-NEXT: "end": {
80 # CHECK-NEXT: "character": 16,
81 # CHECK-NEXT: "line": 0
83 # CHECK-NEXT: "start": {
84 # CHECK-NEXT: "character": 0,
85 # CHECK-NEXT: "line": 0
88 # CHECK-NEXT: "selectionRange": {
89 # CHECK-NEXT: "end": {
90 # CHECK-NEXT: "character": 13,
91 # CHECK-NEXT: "line": 0
93 # CHECK-NEXT: "start": {
94 # CHECK-NEXT: "character": 7,
95 # CHECK-NEXT: "line": 0
98 # CHECK-NEXT: "uri": "file://{{.*}}/clangd-test/main.cpp"
101 # CHECK-NEXT: "range": {
102 # CHECK-NEXT: "end": {
103 # CHECK-NEXT: "character": 25,
104 # CHECK-NEXT: "line": 1
106 # CHECK-NEXT: "start": {
107 # CHECK-NEXT: "character": 0,
108 # CHECK-NEXT: "line": 1
111 # CHECK-NEXT: "selectionRange": {
112 # CHECK-NEXT: "end": {
113 # CHECK-NEXT: "character": 13,
114 # CHECK-NEXT: "line": 1
116 # CHECK-NEXT: "start": {
117 # CHECK-NEXT: "character": 7,
118 # CHECK-NEXT: "line": 1
121 # CHECK-NEXT: "uri": "file://{{.*}}/clangd-test/main.cpp"
124 # CHECK-NEXT: "range": {
125 # CHECK-NEXT: "end": {
126 # CHECK-NEXT: "character": 25,
127 # CHECK-NEXT: "line": 2
129 # CHECK-NEXT: "start": {
130 # CHECK-NEXT: "character": 0,
131 # CHECK-NEXT: "line": 2
134 # CHECK-NEXT: "selectionRange": {
135 # CHECK-NEXT: "end": {
136 # CHECK-NEXT: "character": 13,
137 # CHECK-NEXT: "line": 2
139 # CHECK-NEXT: "start": {
140 # CHECK-NEXT: "character": 7,
141 # CHECK-NEXT: "line": 2
144 # CHECK-NEXT: "uri": "file://{{.*}}/clangd-test/main.cpp"
147 {"jsonrpc":"2.0","id":2,"method":"typeHierarchy/resolve","params":{"item":{"uri":"test:///main.cpp","data":{"symbolID":"A6576FE083F2949A"},"name":"Child3","kind":23,"range":{"end":{"character":13,"line":3},"start":{"character":7,"line":3}},"selectionRange":{"end":{"character":13,"line":3},"start":{"character":7,"line":3}}},"direction":0,"resolve":1}}
149 # CHECK-NEXT: "jsonrpc": "2.0",
150 # CHECK-NEXT: "result": {
151 # CHECK-NEXT: "children": [
153 # CHECK-NEXT: "data": {
154 # CHECK-NEXT: "symbolID": "5705B382DFC77CBC"
156 # CHECK-NEXT: "kind": 23,
157 # CHECK-NEXT: "name": "Child4",
158 # CHECK-NEXT: "range": {
159 # CHECK-NEXT: "end": {
160 # CHECK-NEXT: "character": 13,
161 # CHECK-NEXT: "line": 4
163 # CHECK-NEXT: "start": {
164 # CHECK-NEXT: "character": 7,
165 # CHECK-NEXT: "line": 4
168 # CHECK-NEXT: "selectionRange": {
169 # CHECK-NEXT: "end": {
170 # CHECK-NEXT: "character": 13,
171 # CHECK-NEXT: "line": 4
173 # CHECK-NEXT: "start": {
174 # CHECK-NEXT: "character": 7,
175 # CHECK-NEXT: "line": 4
178 # CHECK-NEXT: "uri": "file://{{.*}}/clangd-test/main.cpp"
181 # CHECK-NEXT: "data": {
182 # CHECK-NEXT: "symbolID": "A6576FE083F2949A"
184 # CHECK-NEXT: "kind": 23,
185 # CHECK-NEXT: "name": "Child3",
186 # CHECK-NEXT: "range": {
187 # CHECK-NEXT: "end": {
188 # CHECK-NEXT: "character": 13,
189 # CHECK-NEXT: "line": 3
191 # CHECK-NEXT: "start": {
192 # CHECK-NEXT: "character": 7,
193 # CHECK-NEXT: "line": 3
196 # CHECK-NEXT: "selectionRange": {
197 # CHECK-NEXT: "end": {
198 # CHECK-NEXT: "character": 13,
199 # CHECK-NEXT: "line": 3
201 # CHECK-NEXT: "start": {
202 # CHECK-NEXT: "character": 7,
203 # CHECK-NEXT: "line": 3
206 # CHECK-NEXT: "uri": "file://{{.*}}/clangd-test/main.cpp"
209 {"jsonrpc":"2.0","id":3,"method":"shutdown"}
211 {"jsonrpc":"2.0","method":"exit"}