summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clangd/ClangdServer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang-tools-extra/clangd/ClangdServer.cpp')
-rw-r--r--clang-tools-extra/clangd/ClangdServer.cpp15
1 files changed, 2 insertions, 13 deletions
diff --git a/clang-tools-extra/clangd/ClangdServer.cpp b/clang-tools-extra/clangd/ClangdServer.cpp
index 577222c20b6..b0b1af1bbe4 100644
--- a/clang-tools-extra/clangd/ClangdServer.cpp
+++ b/clang-tools-extra/clangd/ClangdServer.cpp
@@ -109,6 +109,7 @@ ClangdServer::ClangdServer(const GlobalCompilationDatabase &CDB,
? new FileIndex(Opts.URISchemes,
Opts.HeavyweightDynamicSymbolIndex)
: nullptr),
+ WorkspaceRoot(Opts.WorkspaceRoot),
PCHs(std::make_shared<PCHContainerOperations>()),
// Pass a callback into `WorkScheduler` to extract symbols from a newly
// parsed file and rebuild the file index synchronously each time an AST
@@ -131,18 +132,6 @@ ClangdServer::ClangdServer(const GlobalCompilationDatabase &CDB,
Index = nullptr;
}
-void ClangdServer::setRootPath(PathRef RootPath) {
- auto FS = FSProvider.getFileSystem();
- auto Status = FS->status(RootPath);
- if (!Status)
- elog("Failed to get status for RootPath {0}: {1}", RootPath,
- Status.getError().message());
- else if (Status->isDirectory())
- this->RootPath = RootPath;
- else
- elog("The provided RootPath {0} is not a directory.", RootPath);
-}
-
void ClangdServer::addDocument(PathRef File, StringRef Contents,
WantDiagnostics WantDiags) {
DocVersion Version = ++InternalVersion[File];
@@ -495,7 +484,7 @@ void ClangdServer::onFileEvent(const DidChangeWatchedFilesParams &Params) {
void ClangdServer::workspaceSymbols(
StringRef Query, int Limit, Callback<std::vector<SymbolInformation>> CB) {
CB(clangd::getWorkspaceSymbols(Query, Limit, Index,
- RootPath ? *RootPath : ""));
+ WorkspaceRoot.getValueOr("")));
}
void ClangdServer::documentSymbols(
OpenPOWER on IntegriCloud