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":"extern int x;\nint x = 0;\nint y = x;"}}}
6 {"jsonrpc":"2.0","id":1,"method":"textDocument/definition","params":{"textDocument":{"uri":"test:///main.cpp"},"position":{"line":2,"character":8}}}
8 # CHECK-NEXT: "jsonrpc": "2.0",
9 # CHECK-NEXT: "result": [
11 # CHECK-NEXT: "range": {
12 # CHECK-NEXT: "end": {
13 # CHECK-NEXT: "character": 5,
14 # CHECK-NEXT: "line": 1
16 # CHECK-NEXT: "start": {
17 # CHECK-NEXT: "character": 4,
18 # CHECK-NEXT: "line": 1
21 # CHECK-NEXT: "uri": "file://{{.*}}/{{([A-Z]:/)?}}main.cpp"
25 # Toggle: we're on the definition, so jump to the declaration.
26 {"jsonrpc":"2.0","id":1,"method":"textDocument/definition","params":{"textDocument":{"uri":"test:///main.cpp"},"position":{"line":1,"character":4}}}
28 # CHECK-NEXT: "jsonrpc": "2.0",
29 # CHECK-NEXT: "result": [
31 # CHECK-NEXT: "range": {
32 # CHECK-NEXT: "end": {
33 # CHECK-NEXT: "character": 12,
34 # CHECK-NEXT: "line": 0
36 # CHECK-NEXT: "start": {
37 # CHECK-NEXT: "character": 11,
38 # CHECK-NEXT: "line": 0
41 # CHECK-NEXT: "uri": "file://{{.*}}/{{([A-Z]:/)?}}main.cpp"
45 {"jsonrpc":"2.0","id":1,"method":"textDocument/documentHighlight","params":{"textDocument":{"uri":"test:///main.cpp"},"position":{"line":2,"character":8}}}
47 # CHECK-NEXT: "jsonrpc": "2.0",
48 # CHECK-NEXT: "result": [
50 # CHECK-NEXT: "kind": 1,
51 # CHECK-NEXT: "range": {
52 # CHECK-NEXT: "end": {
53 # CHECK-NEXT: "character": 12,
54 # CHECK-NEXT: "line": 0
56 # CHECK-NEXT: "start": {
57 # CHECK-NEXT: "character": 11,
58 # CHECK-NEXT: "line": 0
63 # CHECK-NEXT: "kind": 1,
64 # CHECK-NEXT: "range": {
65 # CHECK-NEXT: "end": {
66 # CHECK-NEXT: "character": 5,
67 # CHECK-NEXT: "line": 1
69 # CHECK-NEXT: "start": {
70 # CHECK-NEXT: "character": 4,
71 # CHECK-NEXT: "line": 1
76 # CHECK-NEXT: "kind": 2,
77 # CHECK-NEXT: "range": {
78 # CHECK-NEXT: "end": {
79 # CHECK-NEXT: "character": 9,
80 # CHECK-NEXT: "line": 2
82 # CHECK-NEXT: "start": {
83 # CHECK-NEXT: "character": 8,
84 # CHECK-NEXT: "line": 2
90 {"jsonrpc":"2.0","id":10000,"method":"shutdown"}
92 {"jsonrpc":"2.0","method":"exit"}