1# RUN: clangd -lit-test < %s | FileCheck -strict-whitespace %s
2{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":123,"rootPath":"clangd","capabilities":{"textDocument":{"publishDiagnostics":{"codeActionsInline":true}}},"trace":"off"}}
3---
4{"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"test:///foo.c","languageId":"c","text":"struct Point {}; union Point p;"}}}
5#      CHECK:  "method": "textDocument/publishDiagnostics",
6# CHECK-NEXT:  "params": {
7# CHECK-NEXT:    "diagnostics": [
8# CHECK-NEXT:      {
9# CHECK-NEXT:        "code": "use_with_wrong_tag",
10# CHECK-NEXT:        "codeActions": [
11# CHECK-NEXT:          {
12# CHECK-NEXT:            "edit": {
13# CHECK-NEXT:              "changes": {
14# CHECK-NEXT:                "file://{{.*}}/foo.c": [
15# CHECK-NEXT:                  {
16# CHECK-NEXT:                    "newText": "struct",
17# CHECK-NEXT:                    "range": {
18# CHECK-NEXT:                      "end": {
19# CHECK-NEXT:                        "character": 22,
20# CHECK-NEXT:                        "line": 0
21# CHECK-NEXT:                      },
22# CHECK-NEXT:                      "start": {
23# CHECK-NEXT:                        "character": 17,
24# CHECK-NEXT:                        "line": 0
25# CHECK-NEXT:                      }
26# CHECK-NEXT:                    }
27# CHECK-NEXT:                  }
28# CHECK-NEXT:                ]
29# CHECK-NEXT:              }
30# CHECK-NEXT:            },
31# CHECK-NEXT:            "isPreferred": true,
32# CHECK-NEXT:            "kind": "quickfix",
33# CHECK-NEXT:            "title": "change 'union' to 'struct'"
34# CHECK-NEXT:          }
35# CHECK-NEXT:        ],
36# CHECK-NEXT:        "message": "Use of 'Point' with tag type that does not match previous declaration (fix available)\n\nfoo.c:1:8: note: previous use is here",
37# CHECK-NEXT:        "range": {
38# CHECK-NEXT:          "end": {
39# CHECK-NEXT:            "character": 22,
40# CHECK-NEXT:            "line": 0
41# CHECK-NEXT:          },
42# CHECK-NEXT:          "start": {
43# CHECK-NEXT:            "character": 17,
44# CHECK-NEXT:            "line": 0
45# CHECK-NEXT:          }
46# CHECK-NEXT:        },
47# CHECK-NEXT:        "severity": 1,
48# CHECK-NEXT:        "source": "clang"
49# CHECK-NEXT:      },
50# CHECK-NEXT:      {
51# CHECK-NEXT:        "message": "Previous use is here\n\nfoo.c:1:18: error: use of 'Point' with tag type that does not match previous declaration",
52# CHECK-NEXT:        "range": {
53# CHECK-NEXT:          "end": {
54# CHECK-NEXT:            "character": 12,
55# CHECK-NEXT:            "line": 0
56# CHECK-NEXT:          },
57# CHECK-NEXT:          "start": {
58# CHECK-NEXT:            "character": 7,
59# CHECK-NEXT:            "line": 0
60# CHECK-NEXT:          }
61# CHECK-NEXT:        },
62# CHECK-NEXT:        "severity": 3
63# CHECK-NEXT:      }
64# CHECK-NEXT:    ],
65# CHECK-NEXT:    "uri": "file://{{.*}}/foo.c",
66# CHECK-NEXT:    "version": 0
67# CHECK-NEXT:  }
68---
69{"jsonrpc":"2.0","id":4,"method":"shutdown"}
70---
71{"jsonrpc":"2.0","method":"exit"}
72