24#include <boost/asio/post.hpp>
32void dfs(
const Node *N,
const std::string &BasePath,
33 std::vector<DocumentLink> &Links, llvm::StringRef Src) {
38 case Node::NK_ExprPath: {
41 if (
Path.parts().isLiteral()) {
57 dfs(Ch, BasePath, Links, Src);
63void Controller::onDocumentLink(
66 using CheckTy = std::vector<DocumentLink>;
68 Reply = std::move(Reply),
this]()
mutable {
69 return Reply([&]() -> llvm::Expected<CheckTy> {
74 std::vector<DocumentLink> Links;
75 dfs(AST.get(),
File, Links, TU->src());
79 boost::asio::post(Pool, std::move(Action));
#define CheckDefault(x)
Variant of CheckReturn, but returns default constructed CheckTy.
Convert between LSP and nixf types.
Shared path resolution utilities for Nix path literals.
LexerCursorRange range() const
virtual ChildVector children() const =0
Whether current platform treats paths case insensitively.
llvm::unique_function< void(llvm::Expected< T >)> Callback
std::optional< std::string > resolveExprPath(const std::string &BasePath, const std::string &ExprPath)
Resolve a Nix expression path to a real filesystem path.
lspserver::Range toLSPRange(llvm::StringRef Code, const nixf::LexerCursorRange &R)
Parameters for the document link request.
TextDocumentIdentifier textDocument
The document to provide document links for.
URIForFile uri
The text document's URI.
static URIForFile canonicalize(llvm::StringRef AbsPath, llvm::StringRef TUPath)
llvm::StringRef file() const
Retrieves absolute path to the file.