9 #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_CLANGDLSPSERVER_H 10 #define LLVM_CLANG_TOOLS_EXTRA_CLANGD_CLANGDLSPSERVER_H 14 #include "Features.inc" 20 #include "clang/Tooling/Core/Replacement.h" 21 #include "llvm/ADT/Optional.h" 43 llvm::Optional<Path> CompileCommandsDir,
bool UseDirBasedCDB,
44 llvm::Optional<OffsetEncoding> ForcedOffsetEncoding,
56 void onDiagnosticsReady(
PathRef File, std::vector<Diag> Diagnostics)
override;
59 onHighlightingsReady(
PathRef File,
60 std::vector<HighlightingToken> Highlightings)
override;
91 Callback<llvm::Optional<URIForFile>>);
93 Callback<std::vector<DocumentHighlight>>);
97 Callback<std::vector<SymbolInformation>>);
102 Callback<llvm::Optional<TypeHierarchyItem>>);
104 Callback<llvm::Optional<TypeHierarchyItem>>);
107 Callback<std::vector<SymbolDetails>>);
120 void reparseOpenedFiles();
127 void publishDiagnostics(
const URIForFile &File,
128 std::vector<clangd::Diagnostic> Diagnostics);
132 bool ShutdownRequestReceived =
false;
134 std::mutex FixItsMutex;
136 DiagnosticToReplacementMap;
138 llvm::StringMap<DiagnosticToReplacementMap> FixItsMap;
144 std::unique_ptr<MessageHandler> MsgHandler;
145 std::atomic<int> NextCallID = {0};
146 std::mutex TranspWriter;
147 void call(StringRef
Method, llvm::json::Value Params);
148 void notify(StringRef Method, llvm::json::Value Params);
160 bool SupportsCodeAction =
false;
162 bool SupportsHierarchicalDocumentSymbol =
false;
164 bool SupportFileStatus =
false;
168 bool SupportsOffsetsInSignatureHelp =
false;
174 llvm::Optional<Path> CompileCommandsDir;
175 std::unique_ptr<GlobalCompilationDatabase> BaseCDB;
177 llvm::Optional<OverlayCDB> CDB;
181 llvm::Optional<ClangdServer>
Server;
182 llvm::Optional<OffsetEncoding> NegotiatedOffsetEncoding;
187 #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
MockFSProvider FSProvider
Parameters for the semantic highlighting (server-side) push notification.
Clangd extension: parameters configurable at any time, via the workspace/didChangeConfiguration notif...
A LSP-specific comparator used to find diagnostic in a container like std:map.
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
std::bitset< SymbolKindMax+1 > SymbolKindBitset
The type hierarchy params is an extension of the TextDocumentPositionsParams with optional properties...
A thread-safe container for files opened in a workspace, addressed by filenames.
The parameters of a Workspace Symbol Request.
Parameters for the typeHierarchy/resolve request.
This class exposes ClangdServer's capabilities via Language Server Protocol.
ClangdLSPServer(Transport &Transp, const FileSystemProvider &FSProvider, const clangd::CodeCompleteOptions &CCOpts, llvm::Optional< Path > CompileCommandsDir, bool UseDirBasedCDB, llvm::Optional< OffsetEncoding > ForcedOffsetEncoding, const ClangdServer::Options &Opts)
If CompileCommandsDir has a value, compile_commands.json will be loaded only from CompileCommandsDir...