12#include <boost/asio/post.hpp>
24std::vector<Location> findReferences(
const nixf::Node &Desc,
28 llvm::StringRef Src) {
38 for (
const auto *Use : Def.uses()) {
51 Callback<std::vector<Location>> Reply) {
52 using CheckTy = std::vector<Location>;
56 return Reply([&]() -> llvm::Expected<CheckTy> {
59 const auto &Desc =
CheckDefault(AST->descend({Pos, Pos}));
60 const auto &PM = *TU->parentMap();
61 const auto &VLA = *TU->variableLookup();
63 return findReferences(*Desc, PM, VLA,
URI, TU->src());
64 }
catch (std::exception &E) {
65 return error(
"references: {0}", E.what());
69 boost::asio::post(Pool, std::move(Action));
#define CheckDefault(x)
Variant of CheckReturn, but returns default constructed CheckTy
Convert between LSP and nixf types.
std::vector< Location > Locations
Lookup variable names, from it's parent scope.
Whether current platform treats paths case insensitively.
llvm::unique_function< void(llvm::Expected< T >)> Callback
llvm::Error error(std::error_code EC, const char *Fmt, Ts &&...Vals)
nixf::Position toNixfPosition(const lspserver::Position &P)
const nixf::Definition & findDefinition(const nixf::Node &N, const nixf::ParentMapAnalysis &PMA, const nixf::VariableLookupAnalysis &VLA)
Heuristically find definition on some node.
lspserver::Range toLSPRange(llvm::StringRef Code, const nixf::LexerCursorRange &R)
URIForFile uri
The text document's URI.
Position position
The position inside the text document.
TextDocumentIdentifier textDocument
The text document.