diff options
| author | Jan Korous <jkorous@apple.com> | 2018-11-27 16:40:46 +0000 |
|---|---|---|
| committer | Jan Korous <jkorous@apple.com> | 2018-11-27 16:40:46 +0000 |
| commit | b406701f66b242c8878b3f2ada7ec1327c05cacf (patch) | |
| tree | 21c7e4bacb66dc5640a9a1cb6450adf46d531825 /clang-tools-extra/clangd/ClangdServer.cpp | |
| parent | 6089b6192ef9fad95e4bcd2c1071815367e74595 (diff) | |
| download | bcm5719-llvm-b406701f66b242c8878b3f2ada7ec1327c05cacf.tar.gz bcm5719-llvm-b406701f66b242c8878b3f2ada7ec1327c05cacf.zip | |
[clangd] textDocument/SymbolInfo extension
New method returning symbol info for given source position.
Differential Revision: https://reviews.llvm.org/D54799
rdar://problem/46050281
llvm-svn: 347675
Diffstat (limited to 'clang-tools-extra/clangd/ClangdServer.cpp')
| -rw-r--r-- | clang-tools-extra/clangd/ClangdServer.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/clang-tools-extra/clangd/ClangdServer.cpp b/clang-tools-extra/clangd/ClangdServer.cpp index 2b482814433..4a8c7c2587d 100644 --- a/clang-tools-extra/clangd/ClangdServer.cpp +++ b/clang-tools-extra/clangd/ClangdServer.cpp @@ -503,6 +503,18 @@ void ClangdServer::findReferences(PathRef File, Position Pos, WorkScheduler.runWithAST("References", File, Bind(Action, std::move(CB))); } +void ClangdServer::symbolInfo(PathRef File, Position Pos, + Callback<std::vector<SymbolDetails>> CB) { + auto Action = [Pos](Callback<std::vector<SymbolDetails>> CB, + Expected<InputsAndAST> InpAST) { + if (!InpAST) + return CB(InpAST.takeError()); + CB(clangd::getSymbolInfo(InpAST->AST, Pos)); + }; + + WorkScheduler.runWithAST("SymbolInfo", File, Bind(Action, std::move(CB))); +} + std::vector<std::pair<Path, std::size_t>> ClangdServer::getUsedBytesPerFile() const { return WorkScheduler.getUsedBytesPerFile(); |

