[this](decltype(Reply) Reply, URIForFile File, std::string Code,
Range Selection, std::vector<CodeAction> FixIts,
llvm::Expected<std::vector<ClangdServer::TweakRef>> Tweaks) {
- if (!Tweaks) {
- auto Err = Tweaks.takeError();
- if (Err.isA<CancelledError>())
- return Reply(std::move(Err)); // do no logging, this is expected.
- elog("error while getting semantic code actions: {0}",
- std::move(Err));
- return Reply(llvm::json::Array(FixIts));
- }
+ if (!Tweaks)
+ return Reply(Tweaks.takeError());
std::vector<CodeAction> Actions = std::move(FixIts);
Actions.reserve(Actions.size() + Tweaks->size());
# CHECK-NEXT: "uri": "file://{{.*}}/foo.c"
# CHECK-NEXT: }
---
-{"jsonrpc":"2.0","id":2,"method":"textDocument/codeAction","params":{"textDocument":{"uri":"test:///foo.c"},"range":{"start":{"line":104,"character":13},"end":{"line":0,"character":35}},"context":{"diagnostics":[{"range":{"start": {"line": 0, "character": 32}, "end": {"line": 0, "character": 37}},"severity":2,"message":"Using the result of an assignment as a condition without parentheses"}]}}}
+{"jsonrpc":"2.0","id":2,"method":"textDocument/codeAction","params":{"textDocument":{"uri":"test:///foo.c"},"range":{"start":{"line":0,"character":13},"end":{"line":0,"character":35}},"context":{"diagnostics":[{"range":{"start": {"line": 0, "character": 32}, "end": {"line": 0, "character": 37}},"severity":2,"message":"Using the result of an assignment as a condition without parentheses"}]}}}
# CHECK: "id": 2,
# CHECK-NEXT: "jsonrpc": "2.0",
# CHECK-NEXT: "result": [