Debian Codegraph @

clang-tools-extra/clangd/test/completion-snippets.test

raw
1 # RUN: clangd -lit-test < %s | FileCheck -strict-whitespace %s
2 # RUN: clangd -lit-test -pch-storage=memory < %s | FileCheck -strict-whitespace %s
3 {
4 "jsonrpc": "2.0",
5 "id": 0,
6 "method": "initialize",
7 "params": {
8 "processId": 123,
9 "rootPath": "clangd",
10 "capabilities": {
11 "textDocument": {
12 "completion": {
13 "completionItem": {
14 "snippetSupport": true
15 }
16 }
17 }
18 },
19 "trace": "off"
20 }
21 }
22 ---
23 {"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"test:///main.cpp","languageId":"cpp","version":1,"text":"int func_with_args(int a, int b);\nint main() {\nfunc_with\n}"}}}
24 ---
25 {"jsonrpc":"2.0","id":1,"method":"textDocument/completion","params":{"textDocument":{"uri":"test:///main.cpp"},"position":{"line":2,"character":7}}}
26 # CHECK: "id": 1
27 # CHECK-NEXT: "jsonrpc": "2.0",
28 # CHECK-NEXT: "result": {
29 # CHECK-NEXT: "isIncomplete": {{.*}}
30 # CHECK-NEXT: "items": [
31 # CHECK: "filterText": "func_with_args",
32 # CHECK-NEXT: "insertText": "func_with_args(${1:int a}, ${2:int b})",
33 # CHECK-NEXT: "insertTextFormat": 2,
34 # CHECK-NEXT: "kind": 3,
35 # CHECK-NEXT: "label": " func_with_args(int a, int b)",
36 # CHECK-NEXT: "score": {{[0-9]+.[0-9]+}},
37 # CHECK-NEXT: "sortText": "{{.*}}func_with_args"
38 # CHECK-NEXT: "textEdit": {
39 # CHECK-NEXT: "newText": "func_with_args(${1:int a}, ${2:int b})",
40 # CHECK-NEXT: "range": {
41 # CHECK-NEXT: "end": {
42 # CHECK-NEXT: "character": 7,
43 # CHECK-NEXT: "line": 2
44 # CHECK-NEXT: }
45 # CHECK-NEXT: "start": {
46 # CHECK-NEXT: "character": 0,
47 # CHECK-NEXT: "line": 2
48 # CHECK-NEXT: }
49 # CHECK-NEXT: }
50 # CHECK-NEXT: }
51 # CHECK-NEXT: }
52 # CHECK-NEXT: ]
53 # CHECK-NEXT: }
54 ---
55 {"jsonrpc":"2.0","id":4,"method":"shutdown"}
56 ---
57 {"jsonrpc":"2.0","method":"exit"}