blob: e65fc0e8a006425304109eca247a03d1dd6a0ff2 [file] [log] [blame]
Ilya Biryukov38d79772017-05-16 09:38:59 +00001//===--- ClangdLSPServer.h - LSP server --------------------------*- C++-*-===//
2//
Chandler Carruth2946cd72019-01-19 08:50:56 +00003// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
Ilya Biryukov38d79772017-05-16 09:38:59 +00006//
Kirill Bobyrev8e35f1e2018-08-14 16:03:32 +00007//===----------------------------------------------------------------------===//
Ilya Biryukov38d79772017-05-16 09:38:59 +00008
9#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_CLANGDLSPSERVER_H
10#define LLVM_CLANG_TOOLS_EXTRA_CLANGD_CLANGDLSPSERVER_H
11
12#include "ClangdServer.h"
Simon Marchi9569fd52018-03-16 14:30:42 +000013#include "DraftStore.h"
Saleem Abdulrasoole1b9b9d2019-04-10 16:48:52 +000014#include "Features.inc"
Marc-Andre Laperleb387b6e2018-04-23 20:00:52 +000015#include "FindSymbols.h"
Ilya Biryukov103c9512017-06-13 15:59:43 +000016#include "GlobalCompilationDatabase.h"
Ilya Biryukov38d79772017-05-16 09:38:59 +000017#include "Protocol.h"
Sam McCall2c30fbc2018-10-18 12:32:04 +000018#include "Transport.h"
Sam McCallad97ccf2020-04-28 17:49:17 +020019#include "support/Context.h"
Kadir Cetinkaya35871fd2020-09-28 15:09:55 +020020#include "support/MemoryTree.h"
Sam McCallad97ccf2020-04-28 17:49:17 +020021#include "support/Path.h"
Ilya Biryukov38d79772017-05-16 09:38:59 +000022#include "clang/Tooling/Core/Replacement.h"
Krasimir Georgiev0dcb48e2017-07-19 15:43:35 +000023#include "llvm/ADT/Optional.h"
David Goldman60249c22020-01-13 17:01:10 -050024#include "llvm/ADT/StringSet.h"
Sam McCall2cd33e62020-03-04 00:33:29 +010025#include "llvm/Support/JSON.h"
Kadir Cetinkaya35871fd2020-09-28 15:09:55 +020026#include <chrono>
Kadir Cetinkayad0f28742020-10-13 00:10:04 +020027#include <cstddef>
Ilya Biryukov652364b2018-09-26 05:48:29 +000028#include <memory>
Ilya Biryukov38d79772017-05-16 09:38:59 +000029
30namespace clang {
31namespace clangd {
32
Haojian Wuba28e9a2018-01-10 14:44:34 +000033class SymbolIndex;
Ilya Biryukov38d79772017-05-16 09:38:59 +000034
Sam McCall45be5cf2018-09-13 12:58:36 +000035/// This class exposes ClangdServer's capabilities via Language Server Protocol.
36///
Sam McCall2c30fbc2018-10-18 12:32:04 +000037/// MessageHandler binds the implemented LSP methods (e.g. onInitialize) to
38/// corresponding JSON-RPC methods ("initialize").
39/// The server also supports $/cancelRequest (MessageHandler provides this).
Sam McCall6ef1cce2020-01-24 14:08:56 +010040class ClangdLSPServer : private ClangdServer::Callbacks {
Ilya Biryukov38d79772017-05-16 09:38:59 +000041public:
Sam McCall7ba07792020-09-29 10:37:46 +020042 struct Options : ClangdServer::Options {
43 /// Look for compilation databases, rather than using compile commands
44 /// set via LSP (extensions) only.
45 bool UseDirBasedCDB = true;
46 /// A fixed directory to search for a compilation database in.
47 /// If not set, we search upward from the source file.
48 llvm::Optional<Path> CompileCommandsDir;
49 /// The offset-encoding to use, or None to negotiate it over LSP.
Sam McCall6342b382020-09-30 10:56:43 +020050 llvm::Optional<OffsetEncoding> Encoding;
Sam McCall7ba07792020-09-29 10:37:46 +020051
52 /// Per-feature options. Generally ClangdServer lets these vary
53 /// per-request, but LSP allows limited/no customizations.
54 clangd::CodeCompleteOptions CodeComplete;
55 clangd::RenameOptions Rename;
Sam McCall7530b252020-10-02 11:34:40 +020056 /// Returns true if the tweak should be enabled.
57 std::function<bool(const Tweak &)> TweakFilter = [](const Tweak &T) {
58 return !T.hidden(); // only enable non-hidden tweaks.
59 };
Sam McCall7ba07792020-09-29 10:37:46 +020060 };
61
Kadir Cetinkaya8d654df2020-06-17 18:09:54 +020062 ClangdLSPServer(Transport &Transp, const ThreadsafeFS &TFS,
Sam McCall7ba07792020-09-29 10:37:46 +020063 const ClangdLSPServer::Options &Opts);
Sam McCall8bda5f22019-10-23 11:11:18 +020064 /// The destructor blocks on any outstanding background tasks.
Sam McCall2c30fbc2018-10-18 12:32:04 +000065 ~ClangdLSPServer();
Ilya Biryukov38d79772017-05-16 09:38:59 +000066
Sam McCalldc8f3cf2018-10-17 07:32:05 +000067 /// Run LSP server loop, communicating with the Transport provided in the
68 /// constructor. This method must not be executed more than once.
Ilya Biryukov0d9b8a32017-10-25 08:45:41 +000069 ///
Sam McCalldc8f3cf2018-10-17 07:32:05 +000070 /// \return Whether we shut down cleanly with a 'shutdown' -> 'exit' sequence.
71 bool run();
Ilya Biryukov38d79772017-05-16 09:38:59 +000072
Kadir Cetinkaya35871fd2020-09-28 15:09:55 +020073 /// Profiles resource-usage.
74 void profile(MemoryTree &MT) const;
75
Ilya Biryukov38d79772017-05-16 09:38:59 +000076private:
Sam McCall6ef1cce2020-01-24 14:08:56 +010077 // Implement ClangdServer::Callbacks.
Sam McCall2cd33e62020-03-04 00:33:29 +010078 void onDiagnosticsReady(PathRef File, llvm::StringRef Version,
79 std::vector<Diag> Diagnostics) override;
Haojian Wub6188492018-12-20 15:39:12 +000080 void onFileUpdated(PathRef File, const TUStatus &Status) override;
Haojian Wu0a6000f2019-08-26 08:38:45 +000081 void
Sam McCall2cd33e62020-03-04 00:33:29 +010082 onHighlightingsReady(PathRef File, llvm::StringRef Version,
Haojian Wu0a6000f2019-08-26 08:38:45 +000083 std::vector<HighlightingToken> Highlightings) override;
Sam McCall7d20e802020-01-22 19:41:45 +010084 void onBackgroundIndexProgress(const BackgroundQueue::Stats &Stats) override;
Ilya Biryukov103c9512017-06-13 15:59:43 +000085
Sam McCall2c30fbc2018-10-18 12:32:04 +000086 // LSP methods. Notifications have signature void(const Params&).
87 // Calls have signature void(const Params&, Callback<Response>).
88 void onInitialize(const InitializeParams &, Callback<llvm::json::Value>);
Sam McCall8a2d2942020-03-03 12:12:14 +010089 void onInitialized(const InitializedParams &);
Sam McCall2c30fbc2018-10-18 12:32:04 +000090 void onShutdown(const ShutdownParams &, Callback<std::nullptr_t>);
Sam McCall422c8282018-11-26 16:00:11 +000091 void onSync(const NoParams &, Callback<std::nullptr_t>);
Sam McCall2c30fbc2018-10-18 12:32:04 +000092 void onDocumentDidOpen(const DidOpenTextDocumentParams &);
93 void onDocumentDidChange(const DidChangeTextDocumentParams &);
94 void onDocumentDidClose(const DidCloseTextDocumentParams &);
Sam McCall596b63a2020-04-10 03:27:37 +020095 void onDocumentDidSave(const DidSaveTextDocumentParams &);
Sam McCall8adc4d12020-10-16 20:03:48 +020096 void onAST(const ASTParams &, Callback<llvm::Optional<ASTNode>>);
Sam McCall2c30fbc2018-10-18 12:32:04 +000097 void onDocumentOnTypeFormatting(const DocumentOnTypeFormattingParams &,
98 Callback<std::vector<TextEdit>>);
99 void onDocumentRangeFormatting(const DocumentRangeFormattingParams &,
100 Callback<std::vector<TextEdit>>);
101 void onDocumentFormatting(const DocumentFormattingParams &,
102 Callback<std::vector<TextEdit>>);
Ilya Biryukov19d75602018-11-23 15:21:19 +0000103 // The results are serialized 'vector<DocumentSymbol>' if
104 // SupportsHierarchicalDocumentSymbol is true and 'vector<SymbolInformation>'
105 // otherwise.
Sam McCall2c30fbc2018-10-18 12:32:04 +0000106 void onDocumentSymbol(const DocumentSymbolParams &,
Ilya Biryukov19d75602018-11-23 15:21:19 +0000107 Callback<llvm::json::Value>);
Kirill Bobyrev7a514c92020-07-14 09:28:38 +0200108 void onFoldingRange(const FoldingRangeParams &,
109 Callback<std::vector<FoldingRange>>);
Sam McCall2c30fbc2018-10-18 12:32:04 +0000110 void onCodeAction(const CodeActionParams &, Callback<llvm::json::Value>);
Ilya Biryukovb0826bd2019-01-03 13:37:12 +0000111 void onCompletion(const CompletionParams &, Callback<CompletionList>);
Sam McCall2c30fbc2018-10-18 12:32:04 +0000112 void onSignatureHelp(const TextDocumentPositionParams &,
113 Callback<SignatureHelp>);
Sam McCall866ba2c2019-02-01 11:26:13 +0000114 void onGoToDeclaration(const TextDocumentPositionParams &,
115 Callback<std::vector<Location>>);
Sam McCall2c30fbc2018-10-18 12:32:04 +0000116 void onGoToDefinition(const TextDocumentPositionParams &,
117 Callback<std::vector<Location>>);
Utkarsh Saxenab31486a2020-11-18 13:25:09 +0100118 void onGoToImplementation(const TextDocumentPositionParams &,
119 Callback<std::vector<Location>>);
Sam McCall2c30fbc2018-10-18 12:32:04 +0000120 void onReference(const ReferenceParams &, Callback<std::vector<Location>>);
121 void onSwitchSourceHeader(const TextDocumentIdentifier &,
Sam McCallb9ec3e92019-05-07 08:30:32 +0000122 Callback<llvm::Optional<URIForFile>>);
Sam McCall2c30fbc2018-10-18 12:32:04 +0000123 void onDocumentHighlight(const TextDocumentPositionParams &,
124 Callback<std::vector<DocumentHighlight>>);
125 void onFileEvent(const DidChangeWatchedFilesParams &);
126 void onCommand(const ExecuteCommandParams &, Callback<llvm::json::Value>);
127 void onWorkspaceSymbol(const WorkspaceSymbolParams &,
128 Callback<std::vector<SymbolInformation>>);
Haojian Wuf429ab62019-07-24 07:49:23 +0000129 void onPrepareRename(const TextDocumentPositionParams &,
130 Callback<llvm::Optional<Range>>);
Sam McCall2c30fbc2018-10-18 12:32:04 +0000131 void onRename(const RenameParams &, Callback<WorkspaceEdit>);
132 void onHover(const TextDocumentPositionParams &,
133 Callback<llvm::Optional<Hover>>);
Kadir Cetinkaya86658022019-03-19 09:27:04 +0000134 void onTypeHierarchy(const TypeHierarchyParams &,
135 Callback<llvm::Optional<TypeHierarchyItem>>);
Nathan Ridge087b0442019-07-13 03:24:48 +0000136 void onResolveTypeHierarchy(const ResolveTypeHierarchyItemParams &,
137 Callback<llvm::Optional<TypeHierarchyItem>>);
Nathan Ridge0a4f99c2020-11-15 22:45:17 -0500138 void onPrepareCallHierarchy(const CallHierarchyPrepareParams &,
139 Callback<std::vector<CallHierarchyItem>>);
140 void onCallHierarchyIncomingCalls(
141 const CallHierarchyIncomingCallsParams &,
142 Callback<std::vector<CallHierarchyIncomingCall>>);
143 void onCallHierarchyOutgoingCalls(
144 const CallHierarchyOutgoingCallsParams &,
145 Callback<std::vector<CallHierarchyOutgoingCall>>);
Sam McCall2c30fbc2018-10-18 12:32:04 +0000146 void onChangeConfiguration(const DidChangeConfigurationParams &);
Jan Korousb4067012018-11-27 16:40:46 +0000147 void onSymbolInfo(const TextDocumentPositionParams &,
148 Callback<std::vector<SymbolDetails>>);
Utkarsh Saxena55925da2019-09-24 13:38:33 +0000149 void onSelectionRange(const SelectionRangeParams &,
150 Callback<std::vector<SelectionRange>>);
Sam McCall8d7ecc12019-12-16 19:08:51 +0100151 void onDocumentLink(const DocumentLinkParams &,
152 Callback<std::vector<DocumentLink>>);
Sam McCall71177ac2020-03-24 02:24:47 +0100153 void onSemanticTokens(const SemanticTokensParams &, Callback<SemanticTokens>);
Sam McCall5fea54b2020-07-10 16:08:14 +0200154 void onSemanticTokensDelta(const SemanticTokensDeltaParams &,
155 Callback<SemanticTokensOrDelta>);
Kadir Cetinkayad0f28742020-10-13 00:10:04 +0200156 /// This is a clangd extension. Provides a json tree representing memory usage
157 /// hierarchy.
158 void onMemoryUsage(const NoParams &, Callback<MemoryTree>);
Ilya Biryukov38d79772017-05-16 09:38:59 +0000159
Ilya Biryukov71028b82018-03-12 15:28:22 +0000160 std::vector<Fix> getFixes(StringRef File, const clangd::Diagnostic &D);
Ilya Biryukovafb55542017-05-16 14:40:30 +0000161
Ilya Biryukovb0826bd2019-01-03 13:37:12 +0000162 /// Checks if completion request should be ignored. We need this due to the
163 /// limitation of the LSP. Per LSP, a client sends requests for all "trigger
164 /// character" we specify, but for '>' and ':' we need to check they actually
165 /// produce '->' and '::', respectively.
166 bool shouldRunCompletion(const CompletionParams &Params) const;
167
Sam McCall596b63a2020-04-10 03:27:37 +0200168 /// Requests a reparse of currently opened files using their latest source.
169 /// This will typically only rebuild if something other than the source has
170 /// changed (e.g. the CDB yields different flags, or files included in the
171 /// preamble have been modified).
172 void reparseOpenFilesIfNeeded(
173 llvm::function_ref<bool(llvm::StringRef File)> Filter);
Sam McCallbc904612018-10-25 04:22:52 +0000174 void applyConfiguration(const ConfigurationSettings &Settings);
Simon Marchi9569fd52018-03-16 14:30:42 +0000175
Johan Vikstroma848dab2019-07-04 07:53:12 +0000176 /// Sends a "publishSemanticHighlighting" notification to the LSP client.
Sam McCalledf6a192020-03-24 00:31:14 +0100177 void
178 publishTheiaSemanticHighlighting(const TheiaSemanticHighlightingParams &);
Johan Vikstroma848dab2019-07-04 07:53:12 +0000179
Ilya Biryukov49c10712019-03-25 10:15:11 +0000180 /// Sends a "publishDiagnostics" notification to the LSP client.
Sam McCall6525a6b2020-03-03 12:44:40 +0100181 void publishDiagnostics(const PublishDiagnosticsParams &);
Ilya Biryukov49c10712019-03-25 10:15:11 +0000182
Kadir Cetinkaya35871fd2020-09-28 15:09:55 +0200183 /// Runs profiling and exports memory usage metrics if tracing is enabled and
184 /// profiling hasn't happened recently.
185 void maybeExportMemoryProfile();
186
187 /// Timepoint until which profiling is off. It is used to throttle profiling
188 /// requests.
189 std::chrono::steady_clock::time_point NextProfileTime;
190
Kadir Cetinkayab1817062019-10-15 14:59:08 +0000191 /// Since initialization of CDBs and ClangdServer is done lazily, the
192 /// following context captures the one used while creating ClangdLSPServer and
193 /// passes it to above mentioned object instances to make sure they share the
194 /// same state.
Kadir Cetinkaya9d662472019-10-15 14:20:52 +0000195 Context BackgroundContext;
196
Ilya Biryukovafb55542017-05-16 14:40:30 +0000197 /// Used to indicate that the 'shutdown' request was received from the
198 /// Language Server client.
Ilya Biryukov0d9b8a32017-10-25 08:45:41 +0000199 bool ShutdownRequestReceived = false;
200
Haojian Wuf2516342019-08-05 12:48:09 +0000201 /// Used to indicate the ClangdLSPServer is being destroyed.
202 std::atomic<bool> IsBeingDestroyed = {false};
203
Ilya Biryukov38d79772017-05-16 09:38:59 +0000204 std::mutex FixItsMutex;
Ilya Biryukov71028b82018-03-12 15:28:22 +0000205 typedef std::map<clangd::Diagnostic, std::vector<Fix>, LSPDiagnosticCompare>
Ilya Biryukov38d79772017-05-16 09:38:59 +0000206 DiagnosticToReplacementMap;
207 /// Caches FixIts per file and diagnostics
208 llvm::StringMap<DiagnosticToReplacementMap> FixItsMap;
Johan Vikstromc2653ef22019-08-01 08:08:44 +0000209 std::mutex HighlightingsMutex;
210 llvm::StringMap<std::vector<HighlightingToken>> FileToHighlightings;
Sam McCall9e3063e2020-04-01 16:21:44 +0200211 // Last semantic-tokens response, for incremental requests.
212 std::mutex SemanticTokensMutex;
213 llvm::StringMap<SemanticTokens> LastSemanticTokens;
Ilya Biryukov103c9512017-06-13 15:59:43 +0000214
Sam McCall2c30fbc2018-10-18 12:32:04 +0000215 // Most code should not deal with Transport directly.
216 // MessageHandler deals with incoming messages, use call() etc for outgoing.
Sam McCalldc8f3cf2018-10-17 07:32:05 +0000217 clangd::Transport &Transp;
Sam McCall2c30fbc2018-10-18 12:32:04 +0000218 class MessageHandler;
219 std::unique_ptr<MessageHandler> MsgHandler;
Sam McCall2c30fbc2018-10-18 12:32:04 +0000220 std::mutex TranspWriter;
Haojian Wuf2516342019-08-05 12:48:09 +0000221
Sam McCallfa69b602020-09-24 01:14:12 +0200222 template <typename T>
223 static Expected<T> parse(const llvm::json::Value &Raw,
224 llvm::StringRef PayloadName,
225 llvm::StringRef PayloadKind) {
226 T Result;
227 llvm::json::Path::Root Root;
228 if (!fromJSON(Raw, Result, Root)) {
Sam McCall2bd5e3f2020-09-24 01:51:29 +0200229 elog("Failed to decode {0} {1}: {2}", PayloadName, PayloadKind,
230 Root.getError());
Sam McCallfa69b602020-09-24 01:14:12 +0200231 // Dump the relevant parts of the broken message.
232 std::string Context;
233 llvm::raw_string_ostream OS(Context);
234 Root.printErrorContext(Raw, OS);
235 vlog("{0}", OS.str());
236 // Report the error (e.g. to the client).
237 return llvm::make_error<LSPError>(
Sam McCall2bd5e3f2020-09-24 01:51:29 +0200238 llvm::formatv("failed to decode {0} {1}: {2}", PayloadName,
239 PayloadKind, fmt_consume(Root.getError())),
Sam McCallfa69b602020-09-24 01:14:12 +0200240 ErrorCode::InvalidParams);
241 }
242 return std::move(Result);
243 }
244
Haojian Wuf2516342019-08-05 12:48:09 +0000245 template <typename Response>
246 void call(StringRef Method, llvm::json::Value Params, Callback<Response> CB) {
247 // Wrap the callback with LSP conversion and error-handling.
Benjamin Kramer9880b5d2019-08-15 14:16:06 +0000248 auto HandleReply =
Sam McCallfa69b602020-09-24 01:14:12 +0200249 [CB = std::move(CB), Ctx = Context::current().clone(),
250 Method = Method.str()](
Benjamin Kramer9880b5d2019-08-15 14:16:06 +0000251 llvm::Expected<llvm::json::Value> RawResponse) mutable {
Sam McCallfa69b602020-09-24 01:14:12 +0200252 if (!RawResponse)
253 return CB(RawResponse.takeError());
254 CB(parse<Response>(*RawResponse, Method, "response"));
Benjamin Kramer9880b5d2019-08-15 14:16:06 +0000255 };
256 callRaw(Method, std::move(Params), std::move(HandleReply));
Haojian Wuf2516342019-08-05 12:48:09 +0000257 }
258 void callRaw(StringRef Method, llvm::json::Value Params,
259 Callback<llvm::json::Value> CB);
Sam McCall2c30fbc2018-10-18 12:32:04 +0000260 void notify(StringRef Method, llvm::json::Value Params);
Sam McCall7d20e802020-01-22 19:41:45 +0100261 template <typename T> void progress(const llvm::json::Value &Token, T Value) {
262 ProgressParams<T> Params;
263 Params.token = Token;
264 Params.value = std::move(Value);
265 notify("$/progress", Params);
266 }
Sam McCall2c30fbc2018-10-18 12:32:04 +0000267
Kadir Cetinkaya8d654df2020-06-17 18:09:54 +0200268 const ThreadsafeFS &TFS;
Alex Lorenz8626d362018-08-10 17:25:07 +0000269 /// Options used for diagnostics.
270 ClangdDiagnosticOptions DiagOpts;
Marc-Andre Laperleb387b6e2018-04-23 20:00:52 +0000271 /// The supported kinds of the client.
272 SymbolKindBitset SupportedSymbolKinds;
Kadir Cetinkaya133d46f2018-09-27 17:13:07 +0000273 /// The supported completion item kinds of the client.
274 CompletionItemKindBitset SupportedCompletionItemKinds;
Haojian Wub6188492018-12-20 15:39:12 +0000275 /// Whether the client supports CodeAction response objects.
Sam McCall20841d42018-10-16 16:29:41 +0000276 bool SupportsCodeAction = false;
Ilya Biryukov19d75602018-11-23 15:21:19 +0000277 /// From capabilities of textDocument/documentSymbol.
278 bool SupportsHierarchicalDocumentSymbol = false;
Haojian Wub6188492018-12-20 15:39:12 +0000279 /// Whether the client supports showing file status.
280 bool SupportFileStatus = false;
Ilya Biryukovf9169d02019-05-29 10:01:00 +0000281 /// Which kind of markup should we use in textDocument/hover responses.
282 MarkupKind HoverContentFormat = MarkupKind::PlainText;
Ilya Biryukov4ef0f822019-06-04 09:36:59 +0000283 /// Whether the client supports offsets for parameter info labels.
284 bool SupportsOffsetsInSignatureHelp = false;
Sam McCall7d20e802020-01-22 19:41:45 +0100285 std::mutex BackgroundIndexProgressMutex;
286 enum class BackgroundIndexProgress {
287 // Client doesn't support reporting progress. No transitions possible.
288 Unsupported,
289 // The queue is idle, and the client has no progress bar.
290 // Can transition to Creating when we have some activity.
291 Empty,
292 // We've requested the client to create a progress bar.
293 // Meanwhile, the state is buffered in PendingBackgroundIndexProgress.
294 Creating,
295 // The client has a progress bar, and we can send it updates immediately.
296 Live,
297 } BackgroundIndexProgressState = BackgroundIndexProgress::Unsupported;
298 // The progress to send when the progress bar is created.
299 // Only valid in state Creating.
300 BackgroundQueue::Stats PendingBackgroundIndexProgress;
301 /// LSP extension: skip WorkDoneProgressCreate, just send progress streams.
302 bool BackgroundIndexSkipCreate = false;
Ilya Biryukov4ef0f822019-06-04 09:36:59 +0000303 // Store of the current versions of the open documents.
Simon Marchi9569fd52018-03-16 14:30:42 +0000304 DraftStore DraftMgr;
305
Sam McCall7ba07792020-09-29 10:37:46 +0200306 Options Opts;
Sam McCalld1c9d112018-10-23 14:19:54 +0000307 // The CDB is created by the "initialize" LSP method.
Sam McCallc55d09a2018-11-02 13:09:36 +0000308 std::unique_ptr<GlobalCompilationDatabase> BaseCDB;
Kazuaki Ishizakib7ecf1c2020-01-04 10:28:41 -0500309 // CDB is BaseCDB plus any commands overridden via LSP extensions.
Sam McCallc55d09a2018-11-02 13:09:36 +0000310 llvm::Optional<OverlayCDB> CDB;
Sam McCall8bda5f22019-10-23 11:11:18 +0200311 // The ClangdServer is created by the "initialize" LSP method.
312 llvm::Optional<ClangdServer> Server;
Kadir Cetinkaya689bf932018-08-24 13:09:41 +0000313};
Ilya Biryukov38d79772017-05-16 09:38:59 +0000314} // namespace clangd
315} // namespace clang
316
Kirill Bobyrev8e35f1e2018-08-14 16:03:32 +0000317#endif // LLVM_CLANG_TOOLS_EXTRA_CLANGD_CLANGDLSPSERVER_H