[clangd] Run clang-format on all clangd sources. NFC.

llvm-svn: 309801
This commit is contained in:
Ilya Biryukov 2017-08-02 09:08:39 +00:00
parent 4ca7d85d2a
commit 574b753bfd
6 changed files with 20 additions and 17 deletions

View File

@ -70,7 +70,7 @@ public:
void onCompletion(TextDocumentPositionParams Params, StringRef ID,
JSONOutput &Out) override;
void onGoToDefinition(TextDocumentPositionParams Params, StringRef ID,
JSONOutput &Out) override;
JSONOutput &Out) override;
private:
ClangdLSPServer &LangServer;
@ -181,9 +181,11 @@ void ClangdLSPServer::LSPProtocolCallbacks::onCodeAction(
void ClangdLSPServer::LSPProtocolCallbacks::onCompletion(
TextDocumentPositionParams Params, StringRef ID, JSONOutput &Out) {
auto Items = LangServer.Server.codeComplete(
Params.textDocument.uri.file,
Position{Params.position.line, Params.position.character}).Value;
auto Items = LangServer.Server
.codeComplete(Params.textDocument.uri.file,
Position{Params.position.line,
Params.position.character})
.Value;
std::string Completions;
for (const auto &Item : Items) {
@ -200,9 +202,11 @@ void ClangdLSPServer::LSPProtocolCallbacks::onCompletion(
void ClangdLSPServer::LSPProtocolCallbacks::onGoToDefinition(
TextDocumentPositionParams Params, StringRef ID, JSONOutput &Out) {
auto Items = LangServer.Server.findDefinitions(
Params.textDocument.uri.file,
Position{Params.position.line, Params.position.character}).Value;
auto Items = LangServer.Server
.findDefinitions(Params.textDocument.uri.file,
Position{Params.position.line,
Params.position.character})
.Value;
std::string Locations;
for (const auto &Item : Items) {

View File

@ -26,8 +26,8 @@ class JSONOutput;
/// dispatch and ClangdServer together.
class ClangdLSPServer {
public:
ClangdLSPServer(JSONOutput &Out, bool RunSynchronously,
llvm::Optional<StringRef> ResourceDir);
ClangdLSPServer(JSONOutput &Out, bool RunSynchronously,
llvm::Optional<StringRef> ResourceDir);
/// Run LSP server loop, receiving input for it from \p In. \p In must be
/// opened in binary mode. Output will be written using Out variable passed to

View File

@ -878,7 +878,8 @@ CppFile::deferRebuild(StringRef NewContents,
return Diagnostics; // Our rebuild request was cancelled, don't set
// ASTPromise.
That->ASTPromise.set_value(std::make_shared<ParsedASTWrapper>(std::move(NewAST)));
That->ASTPromise.set_value(
std::make_shared<ParsedASTWrapper>(std::move(NewAST)));
} // unlock Mutex
return Diagnostics;

View File

@ -16,11 +16,10 @@
#include "clang/Basic/LLVM.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/Support/Format.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/raw_ostream.h"
using namespace clang::clangd;
URI URI::fromUri(llvm::StringRef uri) {
URI Result;
Result.uri = uri;
@ -53,9 +52,7 @@ URI URI::parse(llvm::yaml::ScalarNode *Param) {
return URI::fromUri(Param->getValue(Storage));
}
std::string URI::unparse(const URI &U) {
return "\"" + U.uri + "\"";
}
std::string URI::unparse(const URI &U) { return "\"" + U.uri + "\""; }
llvm::Optional<TextDocumentIdentifier>
TextDocumentIdentifier::parse(llvm::yaml::MappingNode *Params) {

View File

@ -237,6 +237,7 @@ void clangd::regiterCallbackHandlers(JSONRPCDispatcher &Dispatcher,
Dispatcher.registerHandler(
"textDocument/completion",
llvm::make_unique<CompletionHandler>(Out, Callbacks));
Dispatcher.registerHandler("textDocument/definition",
Dispatcher.registerHandler(
"textDocument/definition",
llvm::make_unique<GotoDefinitionHandler>(Out, Callbacks));
}

View File

@ -47,7 +47,7 @@ public:
virtual void onCompletion(TextDocumentPositionParams Params, StringRef ID,
JSONOutput &Out) = 0;
virtual void onGoToDefinition(TextDocumentPositionParams Params, StringRef ID,
JSONOutput &Out) = 0;
JSONOutput &Out) = 0;
};
void regiterCallbackHandlers(JSONRPCDispatcher &Dispatcher, JSONOutput &Out,