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"}}
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": [
9 # CHECK-NEXT: "code": "use_with_wrong_tag",
10 # CHECK-NEXT: "codeActions": [
12 # CHECK-NEXT: "edit": {
13 # CHECK-NEXT: "changes": {
14 # CHECK-NEXT: "file://{{.*}}/foo.c": [
16 # CHECK-NEXT: "newText": "struct",
17 # CHECK-NEXT: "range": {
18 # CHECK-NEXT: "end": {
19 # CHECK-NEXT: "character": 22,
20 # CHECK-NEXT: "line": 0
22 # CHECK-NEXT: "start": {
23 # CHECK-NEXT: "character": 17,
24 # CHECK-NEXT: "line": 0
31 # CHECK-NEXT: "isPreferred": true,
32 # CHECK-NEXT: "kind": "quickfix",
33 # CHECK-NEXT: "title": "change 'union' to 'struct'"
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
42 # CHECK-NEXT: "start": {
43 # CHECK-NEXT: "character": 17,
44 # CHECK-NEXT: "line": 0
47 # CHECK-NEXT: "severity": 1,
48 # CHECK-NEXT: "source": "clang"
51 # CHECK-NEXT: "codeActions": [],
52 # 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",
53 # CHECK-NEXT: "range": {
54 # CHECK-NEXT: "end": {
55 # CHECK-NEXT: "character": 12,
56 # CHECK-NEXT: "line": 0
58 # CHECK-NEXT: "start": {
59 # CHECK-NEXT: "character": 7,
60 # CHECK-NEXT: "line": 0
63 # CHECK-NEXT: "severity": 3
66 # CHECK-NEXT: "uri": "file://{{.*}}/foo.c",
67 # CHECK-NEXT: "version": 0
70 {"jsonrpc":"2.0","id":4,"method":"shutdown"}
72 {"jsonrpc":"2.0","method":"exit"}