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: "detail": "Child3",
16 # CHECK-NEXT: "kind": 23,
17 # CHECK-NEXT: "name": "Child3",
18 # CHECK-NEXT: "range": {
19 # CHECK-NEXT: "end": {
20 # CHECK-NEXT: "character": 13,
21 # CHECK-NEXT: "line": 3
23 # CHECK-NEXT: "start": {
24 # CHECK-NEXT: "character": 7,
25 # CHECK-NEXT: "line": 3
28 # CHECK-NEXT: "selectionRange": {
29 # CHECK-NEXT: "end": {
30 # CHECK-NEXT: "character": 13,
31 # CHECK-NEXT: "line": 3
33 # CHECK-NEXT: "start": {
34 # CHECK-NEXT: "character": 7,
35 # CHECK-NEXT: "line": 3
38 # CHECK-NEXT: "uri": "file://{{.*}}/clangd-test/main.cpp"
41 # CHECK-NEXT: "data": {
42 # CHECK-NEXT: "parents": [
44 # CHECK-NEXT: "parents": [
46 # CHECK-NEXT: "parents": [],
47 # CHECK-NEXT: "symbolID": "FE546E7B648D69A7"
50 # CHECK-NEXT: "symbolID": "ECDC0C46D75120F4"
53 # CHECK-NEXT: "symbolID": "8A991335E4E67D08"
55 # CHECK-NEXT: "kind": 23,
56 # CHECK-NEXT: "name": "Child2",
57 # CHECK-NEXT: "parents": [
59 # CHECK-NEXT: "data": {
60 # CHECK-NEXT: "parents": [
62 # CHECK-NEXT: "parents": [],
63 # CHECK-NEXT: "symbolID": "FE546E7B648D69A7"
66 # CHECK-NEXT: "symbolID": "ECDC0C46D75120F4"
68 # CHECK-NEXT: "kind": 23,
69 # CHECK-NEXT: "name": "Child1",
70 # CHECK-NEXT: "parents": [
72 # CHECK-NEXT: "data": {
73 # CHECK-NEXT: "parents": [],
74 # CHECK-NEXT: "symbolID": "FE546E7B648D69A7"
76 # CHECK-NEXT: "kind": 23,
77 # CHECK-NEXT: "name": "Parent",
78 # CHECK-NEXT: "parents": [],
79 # CHECK-NEXT: "range": {
80 # CHECK-NEXT: "end": {
81 # CHECK-NEXT: "character": 16,
82 # CHECK-NEXT: "line": 0
84 # CHECK-NEXT: "start": {
85 # CHECK-NEXT: "character": 0,
86 # CHECK-NEXT: "line": 0
89 # CHECK-NEXT: "selectionRange": {
90 # CHECK-NEXT: "end": {
91 # CHECK-NEXT: "character": 13,
92 # CHECK-NEXT: "line": 0
94 # CHECK-NEXT: "start": {
95 # CHECK-NEXT: "character": 7,
96 # CHECK-NEXT: "line": 0
99 # CHECK-NEXT: "uri": "file://{{.*}}/clangd-test/main.cpp"
102 # CHECK-NEXT: "range": {
103 # CHECK-NEXT: "end": {
104 # CHECK-NEXT: "character": 25,
105 # CHECK-NEXT: "line": 1
107 # CHECK-NEXT: "start": {
108 # CHECK-NEXT: "character": 0,
109 # CHECK-NEXT: "line": 1
112 # CHECK-NEXT: "selectionRange": {
113 # CHECK-NEXT: "end": {
114 # CHECK-NEXT: "character": 13,
115 # CHECK-NEXT: "line": 1
117 # CHECK-NEXT: "start": {
118 # CHECK-NEXT: "character": 7,
119 # CHECK-NEXT: "line": 1
122 # CHECK-NEXT: "uri": "file://{{.*}}/clangd-test/main.cpp"
125 # CHECK-NEXT: "range": {
126 # CHECK-NEXT: "end": {
127 # CHECK-NEXT: "character": 25,
128 # CHECK-NEXT: "line": 2
130 # CHECK-NEXT: "start": {
131 # CHECK-NEXT: "character": 0,
132 # CHECK-NEXT: "line": 2
135 # CHECK-NEXT: "selectionRange": {
136 # CHECK-NEXT: "end": {
137 # CHECK-NEXT: "character": 13,
138 # CHECK-NEXT: "line": 2
140 # CHECK-NEXT: "start": {
141 # CHECK-NEXT: "character": 7,
142 # CHECK-NEXT: "line": 2
145 # CHECK-NEXT: "uri": "file://{{.*}}/clangd-test/main.cpp"
148 {"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}}
150 # CHECK-NEXT: "jsonrpc": "2.0",
151 # CHECK-NEXT: "result": {
152 # CHECK-NEXT: "children": [
154 # CHECK-NEXT: "data": {
155 # CHECK-NEXT: "symbolID": "5705B382DFC77CBC"
157 # CHECK-NEXT: "detail": "Child4",
158 # CHECK-NEXT: "kind": 23,
159 # CHECK-NEXT: "name": "Child4",
160 # CHECK-NEXT: "range": {
161 # CHECK-NEXT: "end": {
162 # CHECK-NEXT: "character": 13,
163 # CHECK-NEXT: "line": 4
165 # CHECK-NEXT: "start": {
166 # CHECK-NEXT: "character": 7,
167 # CHECK-NEXT: "line": 4
170 # CHECK-NEXT: "selectionRange": {
171 # CHECK-NEXT: "end": {
172 # CHECK-NEXT: "character": 13,
173 # CHECK-NEXT: "line": 4
175 # CHECK-NEXT: "start": {
176 # CHECK-NEXT: "character": 7,
177 # CHECK-NEXT: "line": 4
180 # CHECK-NEXT: "uri": "file://{{.*}}/clangd-test/main.cpp"
183 # CHECK-NEXT: "data": {
184 # CHECK-NEXT: "symbolID": "A6576FE083F2949A"
186 # CHECK-NEXT: "kind": 23,
187 # CHECK-NEXT: "name": "Child3",
188 # CHECK-NEXT: "range": {
189 # CHECK-NEXT: "end": {
190 # CHECK-NEXT: "character": 13,
191 # CHECK-NEXT: "line": 3
193 # CHECK-NEXT: "start": {
194 # CHECK-NEXT: "character": 7,
195 # CHECK-NEXT: "line": 3
198 # CHECK-NEXT: "selectionRange": {
199 # CHECK-NEXT: "end": {
200 # CHECK-NEXT: "character": 13,
201 # CHECK-NEXT: "line": 3
203 # CHECK-NEXT: "start": {
204 # CHECK-NEXT: "character": 7,
205 # CHECK-NEXT: "line": 3
208 # CHECK-NEXT: "uri": "file://{{.*}}/clangd-test/main.cpp"
211 {"jsonrpc":"2.0","id":3,"method":"shutdown"}
213 {"jsonrpc":"2.0","method":"exit"}