[clang][modules] Don't prevent translation of FW_Private includes when explicitly...
[llvm-project.git] / clang-tools-extra / clangd / test / completion.test
blobd6376b3bfe51bd0af2520a2e3b9de9d099ad37a0
1 # RUN: clangd -lit-test < %s | FileCheck -strict-whitespace %s
2 # RUN: clangd -lit-test -pch-storage=memory < %s | FileCheck -strict-whitespace %s
3 {"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":123,"rootPath":"clangd","capabilities":{},"trace":"off"}}
4 ---
5 {"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"test:///main.cpp","languageId":"cpp","version":1,"text":"struct S { int a; };\nint main() {\nS().\n}"}}}
6 ---
7 {"jsonrpc":"2.0","id":1,"method":"textDocument/completion","params":{"textDocument":{"uri":"test:///main.cpp"},"position":{"line":2,"character":4}}}
8 #      CHECK:  "id": 1
9 # CHECK-NEXT:  "jsonrpc": "2.0",
10 # CHECK-NEXT:  "result": {
11 # CHECK-NEXT:    "isIncomplete": false,
12 # CHECK-NEXT:    "items": [
13 # CHECK-NEXT:    {
14 # CHECK-NEXT:      "detail": "int",
15 # CHECK-NEXT:      "filterText": "a",
16 # CHECK-NEXT:      "insertText": "a",
17 # CHECK-NEXT:      "insertTextFormat": 1,
18 # CHECK-NEXT:      "kind": 5,
19 # CHECK-NEXT:      "label": " a",
20 # CHECK-NEXT:      "score": {{[0-9]+.[0-9]+}},
21 # CHECK-NEXT:      "sortText": "{{.*}}a"
22 # CHECK-NEXT:      "textEdit": {
23 # CHECK-NEXT:        "newText": "a",
24 # CHECK-NEXT:        "range": {
25 # CHECK-NEXT:          "end": {
26 # CHECK-NEXT:            "character": 4,
27 # CHECK-NEXT:            "line": 2
28 # CHECK-NEXT:          }
29 # CHECK-NEXT:          "start": {
30 # CHECK-NEXT:            "character": 4,
31 # CHECK-NEXT:            "line": 2
32 # CHECK-NEXT:          }
33 # CHECK-NEXT:        }
34 # CHECK-NEXT:      }
35 # CHECK-NEXT:    }
36 # CHECK-NEXT:  ]
37 ---
38 # Update the source file and check for completions again.
39 {"jsonrpc":"2.0","method":"textDocument/didChange","params":{"textDocument":{"uri":"test:///main.cpp","version":2},"contentChanges":[{"text":"struct S { int b; };\nint main() {\nS().\n}"}]}}
40 ---
41 {"jsonrpc":"2.0","id":3,"method":"textDocument/completion","params":{"textDocument":{"uri":"test:///main.cpp"},"position":{"line":2,"character":4}}}
42 #      CHECK:  "id": 3,
43 # CHECK-NEXT:  "jsonrpc": "2.0",
44 # CHECK-NEXT:  "result": {
45 # CHECK-NEXT:    "isIncomplete": false,
46 # CHECK-NEXT:    "items": [
47 # CHECK-NEXT:    {
48 # CHECK-NEXT:      "detail": "int",
49 # CHECK-NEXT:      "filterText": "b",
50 # CHECK-NEXT:      "insertText": "b",
51 # CHECK-NEXT:      "insertTextFormat": 1,
52 # CHECK-NEXT:      "kind": 5,
53 # CHECK-NEXT:      "label": " b",
54 # CHECK-NEXT:      "score": {{[0-9]+.[0-9]+}},
55 # CHECK-NEXT:      "sortText": "{{.*}}b"
56 # CHECK-NEXT:      "textEdit": {
57 # CHECK-NEXT:        "newText": "b",
58 # CHECK-NEXT:        "range": {
59 # CHECK-NEXT:          "end": {
60 # CHECK-NEXT:            "character": 4,
61 # CHECK-NEXT:            "line": 2
62 # CHECK-NEXT:          }
63 # CHECK-NEXT:          "start": {
64 # CHECK-NEXT:            "character": 4,
65 # CHECK-NEXT:            "line": 2
66 # CHECK-NEXT:          }
67 # CHECK-NEXT:        }
68 # CHECK-NEXT:      }
69 # CHECK-NEXT:    }
70 # CHECK-NEXT:  ]
71 ---
72 {"jsonrpc":"2.0","id":4,"method":"shutdown"}
73 ---
74 {"jsonrpc":"2.0","method":"exit"}