| # RUN: clangd -lit-test < %s | FileCheck -strict-whitespace %s |
| {"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":123,"rootPath":"clangd","capabilities":{},"trace":"off"}} |
| --- |
| {"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 {};"}}} |
| --- |
| {"jsonrpc":"2.0","id":1,"method":"textDocument/typeHierarchy","params":{"textDocument":{"uri":"test:///main.cpp"},"position":{"line":2,"character":11},"direction":2,"resolve":1}} |
| # CHECK: "id": 1 |
| # CHECK-NEXT: "jsonrpc": "2.0", |
| # CHECK-NEXT: "result": { |
| # CHECK-NEXT: "children": [ |
| # CHECK-NEXT: { |
| # CHECK-NEXT: "data": "A6576FE083F2949A", |
| # CHECK-NEXT: "kind": 23, |
| # CHECK-NEXT: "name": "Child3", |
| # CHECK-NEXT: "range": { |
| # CHECK-NEXT: "end": { |
| # CHECK-NEXT: "character": 13, |
| # CHECK-NEXT: "line": 3 |
| # CHECK-NEXT: }, |
| # CHECK-NEXT: "start": { |
| # CHECK-NEXT: "character": 7, |
| # CHECK-NEXT: "line": 3 |
| # CHECK-NEXT: } |
| # CHECK-NEXT: }, |
| # CHECK-NEXT: "selectionRange": { |
| # CHECK-NEXT: "end": { |
| # CHECK-NEXT: "character": 13, |
| # CHECK-NEXT: "line": 3 |
| # CHECK-NEXT: }, |
| # CHECK-NEXT: "start": { |
| # CHECK-NEXT: "character": 7, |
| # CHECK-NEXT: "line": 3 |
| # CHECK-NEXT: } |
| # CHECK-NEXT: }, |
| # CHECK-NEXT: "uri": "file://{{.*}}/clangd-test/main.cpp" |
| # CHECK-NEXT: } |
| # CHECK-NEXT: ], |
| # CHECK-NEXT: "data": "8A991335E4E67D08", |
| # CHECK-NEXT: "kind": 23, |
| # CHECK-NEXT: "name": "Child2", |
| # CHECK-NEXT: "parents": [ |
| # CHECK-NEXT: { |
| # CHECK-NEXT: "data": "ECDC0C46D75120F4", |
| # CHECK-NEXT: "kind": 23, |
| # CHECK-NEXT: "name": "Child1", |
| # CHECK-NEXT: "parents": [ |
| # CHECK-NEXT: { |
| # CHECK-NEXT: "data": "FE546E7B648D69A7", |
| # CHECK-NEXT: "kind": 23, |
| # CHECK-NEXT: "name": "Parent", |
| # CHECK-NEXT: "parents": [], |
| # CHECK-NEXT: "range": { |
| # CHECK-NEXT: "end": { |
| # CHECK-NEXT: "character": 16, |
| # CHECK-NEXT: "line": 0 |
| # CHECK-NEXT: }, |
| # CHECK-NEXT: "start": { |
| # CHECK-NEXT: "character": 0, |
| # CHECK-NEXT: "line": 0 |
| # CHECK-NEXT: } |
| # CHECK-NEXT: }, |
| # CHECK-NEXT: "selectionRange": { |
| # CHECK-NEXT: "end": { |
| # CHECK-NEXT: "character": 13, |
| # CHECK-NEXT: "line": 0 |
| # CHECK-NEXT: }, |
| # CHECK-NEXT: "start": { |
| # CHECK-NEXT: "character": 7, |
| # CHECK-NEXT: "line": 0 |
| # CHECK-NEXT: } |
| # CHECK-NEXT: }, |
| # CHECK-NEXT: "uri": "file://{{.*}}/clangd-test/main.cpp" |
| # CHECK-NEXT: } |
| # CHECK-NEXT: ], |
| # CHECK-NEXT: "range": { |
| # CHECK-NEXT: "end": { |
| # CHECK-NEXT: "character": 25, |
| # CHECK-NEXT: "line": 1 |
| # CHECK-NEXT: }, |
| # CHECK-NEXT: "start": { |
| # CHECK-NEXT: "character": 0, |
| # CHECK-NEXT: "line": 1 |
| # CHECK-NEXT: } |
| # CHECK-NEXT: }, |
| # CHECK-NEXT: "selectionRange": { |
| # CHECK-NEXT: "end": { |
| # CHECK-NEXT: "character": 13, |
| # CHECK-NEXT: "line": 1 |
| # CHECK-NEXT: }, |
| # CHECK-NEXT: "start": { |
| # CHECK-NEXT: "character": 7, |
| # CHECK-NEXT: "line": 1 |
| # CHECK-NEXT: } |
| # CHECK-NEXT: }, |
| # CHECK-NEXT: "uri": "file://{{.*}}/clangd-test/main.cpp" |
| # CHECK-NEXT: } |
| # CHECK-NEXT: ], |
| # CHECK-NEXT: "range": { |
| # CHECK-NEXT: "end": { |
| # CHECK-NEXT: "character": 25, |
| # CHECK-NEXT: "line": 2 |
| # CHECK-NEXT: }, |
| # CHECK-NEXT: "start": { |
| # CHECK-NEXT: "character": 0, |
| # CHECK-NEXT: "line": 2 |
| # CHECK-NEXT: } |
| # CHECK-NEXT: }, |
| # CHECK-NEXT: "selectionRange": { |
| # CHECK-NEXT: "end": { |
| # CHECK-NEXT: "character": 13, |
| # CHECK-NEXT: "line": 2 |
| # CHECK-NEXT: }, |
| # CHECK-NEXT: "start": { |
| # CHECK-NEXT: "character": 7, |
| # CHECK-NEXT: "line": 2 |
| # CHECK-NEXT: } |
| # CHECK-NEXT: }, |
| # CHECK-NEXT: "uri": "file://{{.*}}/clangd-test/main.cpp" |
| # CHECK-NEXT: } |
| --- |
| {"jsonrpc":"2.0","id":2,"method":"typeHierarchy/resolve","params":{"item":{"uri":"test:///main.cpp","data":"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}} |
| # CHECK: "id": 2 |
| # CHECK-NEXT: "jsonrpc": "2.0", |
| # CHECK-NEXT: "result": { |
| # CHECK-NEXT: "children": [ |
| # CHECK-NEXT: { |
| # CHECK-NEXT: "data": "5705B382DFC77CBC", |
| # CHECK-NEXT: "kind": 23, |
| # CHECK-NEXT: "name": "Child4", |
| # CHECK-NEXT: "range": { |
| # CHECK-NEXT: "end": { |
| # CHECK-NEXT: "character": 13, |
| # CHECK-NEXT: "line": 4 |
| # CHECK-NEXT: }, |
| # CHECK-NEXT: "start": { |
| # CHECK-NEXT: "character": 7, |
| # CHECK-NEXT: "line": 4 |
| # CHECK-NEXT: } |
| # CHECK-NEXT: }, |
| # CHECK-NEXT: "selectionRange": { |
| # CHECK-NEXT: "end": { |
| # CHECK-NEXT: "character": 13, |
| # CHECK-NEXT: "line": 4 |
| # CHECK-NEXT: }, |
| # CHECK-NEXT: "start": { |
| # CHECK-NEXT: "character": 7, |
| # CHECK-NEXT: "line": 4 |
| # CHECK-NEXT: } |
| # CHECK-NEXT: }, |
| # CHECK-NEXT: "uri": "file://{{.*}}/clangd-test/main.cpp" |
| # CHECK-NEXT: } |
| # CHECK-NEXT: ], |
| # CHECK-NEXT: "data": "A6576FE083F2949A", |
| # CHECK-NEXT: "kind": 23, |
| # CHECK-NEXT: "name": "Child3", |
| # CHECK-NEXT: "range": { |
| # CHECK-NEXT: "end": { |
| # CHECK-NEXT: "character": 13, |
| # CHECK-NEXT: "line": 3 |
| # CHECK-NEXT: }, |
| # CHECK-NEXT: "start": { |
| # CHECK-NEXT: "character": 7, |
| # CHECK-NEXT: "line": 3 |
| # CHECK-NEXT: } |
| # CHECK-NEXT: }, |
| # CHECK-NEXT: "selectionRange": { |
| # CHECK-NEXT: "end": { |
| # CHECK-NEXT: "character": 13, |
| # CHECK-NEXT: "line": 3 |
| # CHECK-NEXT: }, |
| # CHECK-NEXT: "start": { |
| # CHECK-NEXT: "character": 7, |
| # CHECK-NEXT: "line": 3 |
| # CHECK-NEXT: } |
| # CHECK-NEXT: }, |
| # CHECK-NEXT: "uri": "file://{{.*}}/clangd-test/main.cpp" |
| # CHECK-NEXT: } |
| --- |
| {"jsonrpc":"2.0","id":3,"method":"shutdown"} |
| --- |
| {"jsonrpc":"2.0","method":"exit"} |