1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
# RUN: clangd -pretty -run-synchronously < %s | FileCheck -strict-whitespace %s
Content-Length: 125
{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":123,"rootPath":"clangd","capabilities":{},"trace":"off"}}
Content-Length: 297
{"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"file:///main.cpp","languageId":"cpp","version":1,"text":"class Foo {\n public:\n int foo() const;\n int bar() const;\n};\n\nclass Bar : public Foo {\n int foo() const;\n};\n\nvoid test() {\n Bar().\n}"}}}
Content-Length: 151
{"jsonrpc":"2.0","id":2,"method":"textDocument/completion","params":{"textDocument":{"uri":"file:///main.cpp"},"position":{"line":11,"character":8}}}
# CHECK: "id": 2,
# CHECK-NEXT: "jsonrpc": "2.0",
# CHECK-NEXT: "result": [
# Eligible const functions are at the top of the list.
# CHECK-NEXT: {
# CHECK-NEXT: "detail": "int",
# CHECK-NEXT: "filterText": "bar",
# CHECK-NEXT: "insertText": "bar",
# CHECK-NEXT: "insertTextFormat": 1,
# CHECK-NEXT: "kind": 2,
# CHECK-NEXT: "label": "bar() const",
# CHECK-NEXT: "sortText": "000037bar"
# CHECK-NEXT: },
# CHECK-NEXT: {
# CHECK-NEXT: "detail": "int",
# CHECK-NEXT: "filterText": "foo",
# CHECK-NEXT: "insertText": "foo",
# CHECK-NEXT: "insertTextFormat": 1,
# CHECK-NEXT: "kind": 2,
# CHECK-NEXT: "label": "Foo::foo() const",
# CHECK-NEXT: "sortText": "000037foo"
# CHECK-NEXT: },
# Ineligible non-const function is at the bottom of the list.
# CHECK-NEXT: {
# CHECK: "detail": "int",
# CHECK: "filterText": "foo",
# CHECK-NEXT: "insertText": "foo",
# CHECK-NEXT: "insertTextFormat": 1,
# CHECK-NEXT: "kind": 2,
# CHECK-NEXT: "label": "foo() const",
# CHECK-NEXT: "sortText": "200035foo"
# CHECK-NEXT: }
# CHECK-NEXT: ]
Content-Length: 44
{"jsonrpc":"2.0","id":4,"method":"shutdown"}
Content-Length: 33
{"jsonrpc":"2.0":"method":"exit"}
|