10 #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_CLANGDLSPSERVER_H 11 #define LLVM_CLANG_TOOLS_EXTRA_CLANGD_CLANGDLSPSERVER_H 20 #include "clang/Tooling/Core/Replacement.h" 21 #include "llvm/ADT/Optional.h" 42 llvm::Optional<Path> CompileCommandsDir,
bool UseDirBasedCDB,
54 void onDiagnosticsReady(
PathRef File, std::vector<Diag> Diagnostics)
override;
86 Callback<std::vector<DocumentHighlight>>);
90 Callback<std::vector<SymbolInformation>>);
96 Callback<std::vector<SymbolDetails>>);
109 void reparseOpenedFiles();
114 bool ShutdownRequestReceived =
false;
116 std::mutex FixItsMutex;
118 DiagnosticToReplacementMap;
120 llvm::StringMap<DiagnosticToReplacementMap> FixItsMap;
126 std::unique_ptr<MessageHandler> MsgHandler;
127 std::atomic<int> NextCallID = {0};
128 std::mutex TranspWriter;
129 void call(StringRef
Method, llvm::json::Value Params);
130 void notify(StringRef Method, llvm::json::Value Params);
142 bool SupportsCodeAction =
false;
144 bool SupportsHierarchicalDocumentSymbol =
false;
146 bool SupportFileStatus =
false;
153 std::unique_ptr<GlobalCompilationDatabase> BaseCDB;
155 llvm::Optional<OverlayCDB> CDB;
159 llvm::Optional<ClangdServer> Server;
164 #endif // LLVM_CLANG_TOOLS_EXTRA_CLANGD_CLANGDLSPSERVER_H
Exact commands are not specified in the protocol so we define the ones supported by Clangd here...
bool run()
Run LSP server loop, communicating with the Transport provided in the constructor.
llvm::StringRef PathRef
A typedef to represent a ref to file path.
llvm::unique_function< void(llvm::Expected< T >)> Callback
A Callback<T> is a void function that accepts Expected<T>.
std::bitset< CompletionItemKindMax+1 > CompletionItemKindBitset
Clangd extension: parameters configurable at any time, via the workspace/didChangeConfiguration notif...
ClangdLSPServer(Transport &Transp, const clangd::CodeCompleteOptions &CCOpts, llvm::Optional< Path > CompileCommandsDir, bool UseDirBasedCDB, const ClangdServer::Options &Opts)
If CompileCommandsDir has a value, compile_commands.json will be loaded only from CompileCommandsDir...
A LSP-specific comparator used to find diagnostic in a container like std:map.
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
std::bitset< SymbolKindMax+1 > SymbolKindBitset
A thread-safe container for files opened in a workspace, addressed by filenames.
The parameters of a Workspace Symbol Request.
This class exposes ClangdServer's capabilities via Language Server Protocol.
static llvm::cl::opt< Path > CompileCommandsDir("compile-commands-dir", llvm::cl::desc("Specify a path to look for compile_commands.json. If path " "is invalid, clangd will look in the current directory and " "parent paths of each source file."))