auto File = Params.textDocument.uri.file;
auto Replacements = Server.rename(File, Params.position, Params.newName);
if (!Replacements) {
- C.replyError(
- ErrorCode::InternalError,
- llvm::toString(Replacements.takeError()));
+ C.replyError(ErrorCode::InternalError,
+ llvm::toString(Replacements.takeError()));
return;
}
std::string Code = Server.getDocument(File);
#include "ClangdServer.h"
#include "clang/Format/Format.h"
-#include "clang/Tooling/Refactoring/RefactoringResultConsumer.h"
-#include "clang/Tooling/Refactoring/Rename/RenamingAction.h"
#include "clang/Frontend/CompilerInstance.h"
#include "clang/Frontend/CompilerInvocation.h"
#include "clang/Tooling/CompilationDatabase.h"
+#include "clang/Tooling/Refactoring/RefactoringResultConsumer.h"
+#include "clang/Tooling/Refactoring/Rename/RenamingAction.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/Support/Errc.h"
#include "llvm/Support/FileSystem.h"
});
}
-void RequestContext::replyError(ErrorCode code, const llvm::StringRef &Message) {
+void RequestContext::replyError(ErrorCode code,
+ const llvm::StringRef &Message) {
Out.log("Error " + Twine(static_cast<int>(code)) + ": " + Message + "\n");
if (ID) {
Out.writeMessage(json::obj{
{"jsonrpc", "2.0"},
{"id", *ID},
- {"error", json::obj{{"code", static_cast<int>(code)}, {"message", Message}}},
+ {"error",
+ json::obj{{"code", static_cast<int>(code)}, {"message", Message}}},
});
}
}
if (KeyValue == "textDocument") {
auto *Value =
- dyn_cast_or_null<llvm::yaml::MappingNode>(NextKeyValue.getValue());
+ dyn_cast_or_null<llvm::yaml::MappingNode>(NextKeyValue.getValue());
if (!Value)
continue;
auto *Map = dyn_cast<llvm::yaml::MappingNode>(Value);
}
})";
- EXPECT_EQ(
- str,
- sp(obj{
- {"empty_object", obj{}},
- {"empty_array", {}},
- {"full_array", {1, nullptr}},
- {"full_object",
- obj{
- {"nested_array",
- {obj{
- {"property", "value"},
- }}},
- }},
- }));
+ EXPECT_EQ(str, sp(obj{
+ {"empty_object", obj{}},
+ {"empty_array", {}},
+ {"full_array", {1, nullptr}},
+ {"full_object",
+ obj{
+ {"nested_array",
+ {obj{
+ {"property", "value"},
+ }}},
+ }},
+ }));
}
} // namespace