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":"namespace ns { int ns_member; } struct vector { int size; static int default_capacity; };\nvoid test(vector *a, vector *b) {\n if (a > b) {} \n a->size = 10;\n\n a ? a : b;\n ns::ns_member = 10;\n}"}}}
6 {"jsonrpc":"2.0","id":1,"method":"textDocument/completion","params":{"textDocument":{"uri":"test:///main.cpp"},"position":{"line":2,"character":9},"context":{"triggerKind":2,"triggerCharacter":">"}}}
8 # CHECK-NEXT: "jsonrpc": "2.0"
9 # CHECK-NEXT: "result": {
10 # CHECK-NEXT: "isIncomplete": false,
11 # CHECK-NEXT: "items": []
14 {"jsonrpc":"2.0","id":2,"method":"textDocument/completion","params":{"textDocument":{"uri":"test:///main.cpp"},"position":{"line":3,"character":5},"context":{"triggerKind":2,"triggerCharacter":">"}}}
16 # CHECK-NEXT: "jsonrpc": "2.0"
17 # CHECK-NEXT: "result": {
18 # CHECK-NEXT: "isIncomplete": false,
19 # CHECK-NEXT: "items": [
21 # CHECK-NEXT: "detail": "int",
22 # CHECK-NEXT: "filterText": "size",
23 # CHECK-NEXT: "insertText": "size",
24 # CHECK-NEXT: "insertTextFormat": 1,
25 # CHECK-NEXT: "kind": 5,
26 # CHECK-NEXT: "label": " size",
27 # CHECK-NEXT: "score": {{[0-9]+.[0-9]+}},
28 # CHECK-NEXT: "sortText": "{{.*}}size",
29 # CHECK-NEXT: "textEdit": {
30 # CHECK-NEXT: "newText": "size",
31 # CHECK-NEXT: "range": {
32 # CHECK-NEXT: "end": {
33 # CHECK-NEXT: "character": 5,
34 # CHECK-NEXT: "line": 3
36 # CHECK-NEXT: "start": {
37 # CHECK-NEXT: "character": 5,
38 # CHECK-NEXT: "line": 3
44 # CHECK-NEXT: "detail": "int",
45 # CHECK-NEXT: "filterText": "default_capacity",
46 # CHECK-NEXT: "insertText": "default_capacity",
47 # CHECK-NEXT: "insertTextFormat": 1,
48 # CHECK-NEXT: "kind": 10,
49 # CHECK-NEXT: "label": " default_capacity",
50 # CHECK-NEXT: "score": {{[0-9]+.[0-9]+}},
51 # CHECK-NEXT: "sortText": "{{.*}}default_capacity",
52 # CHECK-NEXT: "textEdit": {
53 # CHECK-NEXT: "newText": "default_capacity",
54 # CHECK-NEXT: "range": {
55 # CHECK-NEXT: "end": {
56 # CHECK-NEXT: "character": 5,
57 # CHECK-NEXT: "line": 3
59 # CHECK-NEXT: "start": {
60 # CHECK-NEXT: "character": 5,
61 # CHECK-NEXT: "line": 3
69 {"jsonrpc":"2.0","id":3,"method":"textDocument/completion","params":{"textDocument":{"uri":"test:///main.cpp"},"position":{"line":5,"character":9},"context":{"triggerKind":2,"triggerCharacter":":"}}}
71 # CHECK-NEXT: "jsonrpc": "2.0",
72 # CHECK-NEXT: "result": {
73 # CHECK-NEXT: "isIncomplete": false,
74 # CHECK-NEXT: "items": []
77 {"jsonrpc":"2.0","id":4,"method":"textDocument/completion","params":{"textDocument":{"uri":"test:///main.cpp"},"position":{"line":6,"character":6},"context":{"triggerKind":2,"triggerCharacter":":"}}}
80 # CHECK-NEXT: "jsonrpc": "2.0"
81 # CHECK-NEXT: "result": {
82 # CHECK-NEXT: "isIncomplete": false,
83 # CHECK-NEXT: "items": [
85 # CHECK-NEXT: "detail": "int",
86 # CHECK-NEXT: "filterText": "ns_member",
87 # CHECK-NEXT: "insertText": "ns_member",
88 # CHECK-NEXT: "insertTextFormat": 1,
89 # CHECK-NEXT: "kind": 6,
90 # CHECK-NEXT: "label": " ns_member",
91 # CHECK-NEXT: "score": {{[0-9]+.[0-9]+}},
92 # CHECK-NEXT: "sortText": "{{.*}}ns_member",
93 # CHECK-NEXT: "textEdit": {
94 # CHECK-NEXT: "newText": "ns_member",
95 # CHECK-NEXT: "range": {
96 # CHECK-NEXT: "end": {
97 # CHECK-NEXT: "character": 6,
98 # CHECK-NEXT: "line": 6
100 # CHECK-NEXT: "start": {
101 # CHECK-NEXT: "character": 6,
102 # CHECK-NEXT: "line": 6
109 {"jsonrpc":"2.0","id":5,"method":"shutdown"}
111 {"jsonrpc":"2.0","method":"exit"}