forked from OSchip/llvm-project
113 lines
5.5 KiB
Plaintext
113 lines
5.5 KiB
Plaintext
# RUN: clangd -pretty -run-synchronously < %s | FileCheck -strict-whitespace %s
|
|
# It is absolutely vital that this file has CRLF line endings.
|
|
#
|
|
Content-Length: 125
|
|
|
|
{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":123,"rootPath":"clangd","capabilities":{},"trace":"off"}}
|
|
#
|
|
Content-Length: 180
|
|
|
|
{"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"file:///foo.c","languageId":"c","version":1,"text":"int main(int i, char **a) { if (i = 2) {}}"}}}
|
|
# CHECK: "method": "textDocument/publishDiagnostics",
|
|
# CHECK-NEXT: "params": {
|
|
# CHECK-NEXT: "diagnostics": [
|
|
# CHECK-NEXT: {
|
|
# CHECK-NEXT: "message": "using the result of an assignment as a condition without parentheses",
|
|
# CHECK-NEXT: "range": {
|
|
# CHECK-NEXT: "end": {
|
|
# CHECK-NEXT: "character": 37,
|
|
# CHECK-NEXT: "line": 0
|
|
# CHECK-NEXT: },
|
|
# CHECK-NEXT: "start": {
|
|
# CHECK-NEXT: "character": 32,
|
|
# CHECK-NEXT: "line": 0
|
|
# CHECK-NEXT: }
|
|
# CHECK-NEXT: },
|
|
# CHECK-NEXT: "severity": 2
|
|
# CHECK-NEXT: },
|
|
# CHECK-NEXT: {
|
|
# CHECK-NEXT: "message": "place parentheses around the assignment to silence this warning",
|
|
# CHECK-NEXT: "range": {
|
|
# CHECK-NEXT: "end": {
|
|
# CHECK-NEXT: "character": 35,
|
|
# CHECK-NEXT: "line": 0
|
|
# CHECK-NEXT: },
|
|
# CHECK-NEXT: "start": {
|
|
# CHECK-NEXT: "character": 34,
|
|
# CHECK-NEXT: "line": 0
|
|
# CHECK-NEXT: }
|
|
# CHECK-NEXT: },
|
|
# CHECK-NEXT: "severity": 3
|
|
# CHECK-NEXT: },
|
|
# CHECK-NEXT: {
|
|
# CHECK-NEXT: "message": "use '==' to turn this assignment into an equality comparison",
|
|
# CHECK-NEXT: "range": {
|
|
# CHECK-NEXT: "end": {
|
|
# CHECK-NEXT: "character": 35,
|
|
# CHECK-NEXT: "line": 0
|
|
# CHECK-NEXT: },
|
|
# CHECK-NEXT: "start": {
|
|
# CHECK-NEXT: "character": 34,
|
|
# CHECK-NEXT: "line": 0
|
|
# CHECK-NEXT: }
|
|
# CHECK-NEXT: },
|
|
# CHECK-NEXT: "severity": 3
|
|
# CHECK-NEXT: }
|
|
# CHECK-NEXT: ],
|
|
# CHECK-NEXT: "uri": "file:///foo.c"
|
|
# CHECK-NEXT: }
|
|
Content-Length: 72
|
|
|
|
{"jsonrpc":"2.0","id":3,"method":"workspace/executeCommand","params":{}}
|
|
# No command name
|
|
Content-Length: 85
|
|
|
|
{"jsonrpc":"2.0","id":4,"method":"workspace/executeCommand","params":{"command": {}}}
|
|
# Invalid, non-scalar command name
|
|
Content-Length: 345
|
|
|
|
{"jsonrpc":"2.0","id":5,"method":"workspace/executeCommand","params":{"command":"clangd.applyFix","custom":"foo", "arguments":[{"changes":{"file:///foo.c":[{"range":{"start":{"line":0,"character":32},"end":{"line":0,"character":32}},"newText":"("},{"range":{"start":{"line":0,"character":37},"end":{"line":0,"character":37}},"newText":")"}]}}]}}
|
|
Content-Length: 117
|
|
|
|
{"jsonrpc":"2.0","id":6,"method":"workspace/executeCommand","params":{"command":"clangd.applyFix","arguments":"foo"}}
|
|
# Arguments not a sequence.
|
|
Content-Length: 93
|
|
|
|
{"jsonrpc":"2.0","id":7,"method":"workspace/executeCommand","params":{"command":"mycommand"}}
|
|
# Unknown command.
|
|
Content-Length: 132
|
|
|
|
{"jsonrpc":"2.0","id":8,"method":"workspace/executeCommand","params":{"command":"clangd.applyFix","custom":"foo", "arguments":[""]}}
|
|
# ApplyFix argument not a mapping node.
|
|
Content-Length: 345
|
|
|
|
{"jsonrpc":"2.0","id":9,"method":"workspace/executeCommand","params":{"command":"clangd.applyFix","arguments":[{"custom":"foo", "changes":{"file:///foo.c":[{"range":{"start":{"line":0,"character":32},"end":{"line":0,"character":32}},"newText":"("},{"range":{"start":{"line":0,"character":37},"end":{"line":0,"character":37}},"newText":")"}]}}]}}
|
|
# Custom field in WorkspaceEdit
|
|
Content-Length: 132
|
|
|
|
{"jsonrpc":"2.0","id":10,"method":"workspace/executeCommand","params":{"command":"clangd.applyFix","arguments":[{"changes":"foo"}]}}
|
|
# changes in WorkspaceEdit with no mapping node
|
|
Content-Length: 346
|
|
|
|
{"jsonrpc":"2.0","id":11,"method":"workspace/executeCommand","params":{"command":"clangd.applyFix","arguments":[{"changes":{"file:///foo.c":[{"range":{"start":{"line":0,"character":32},"end":{"line":0,"character":32}},"newText":"("},{"range":{"start":{"line":0,"character":37},"end":{"line":0,"character":37}},"newText":")"}], "custom":"foo"}}]}}
|
|
# Custom field in WorkspaceEditChange
|
|
Content-Length: 150
|
|
|
|
{"jsonrpc":"2.0","id":12,"method":"workspace/executeCommand","params":{"command":"clangd.applyFix","arguments":[{"changes":{"file:///foo.c":"bar"}}]}}
|
|
# No sequence node for TextEdits
|
|
Content-Length: 149
|
|
|
|
{"jsonrpc":"2.0","id":13,"method":"workspace/executeCommand","params":{"command":"clangd.applyFix","arguments":[{"changes":{"file:///foo.c":[""]}}]}}
|
|
# No mapping node for TextEdit
|
|
Content-Length: 265
|
|
|
|
{"jsonrpc":"2.0","id":14,"method":"workspace/executeCommand","params":{"command":"clangd.applyFix","arguments":[{"changes":{"file:///foo.c":[{"range":{"start":{"line":0,"character":32},"end":{"line":0,"character":32}},"newText":"("},{"range":"","newText":")"}]}}]}}
|
|
# TextEdit not decoded
|
|
Content-Length: 345
|
|
|
|
{"jsonrpc":"2.0","id":9,"method":"workspace/executeCommand","params":{"arguments":[{"custom":"foo", "changes":{"file:///foo.c":[{"range":{"start":{"line":0,"character":32},"end":{"line":0,"character":32}},"newText":"("},{"range":{"start":{"line":0,"character":37},"end":{"line":0,"character":37}},"newText":")"}]}}],"command":"clangd.applyFix"}}
|
|
# Command name after arguments
|
|
Content-Length: 44
|
|
|
|
{"jsonrpc":"2.0","id":3,"method":"shutdown"}
|