11#include <boost/asio/post.hpp>
15using namespace llvm::json;
19 Callback<std::vector<CodeAction>> Reply) {
20 using CheckTy = std::vector<CodeAction>;
23 auto Action = [Reply = std::move(Reply),
File,
Range,
this]()
mutable {
24 return Reply([&]() -> llvm::Expected<CheckTy> {
27 const auto &Diagnostics = TU->diagnostics();
28 auto Actions = std::vector<CodeAction>();
29 Actions.reserve(Diagnostics.size());
31 auto DRange =
toLSPRange(TU->src(), D.range());
37 std::vector<TextEdit> Edits;
38 Edits.reserve(F.edits().size());
42 .newText = std::string(TE.newText()),
45 using Changes = std::map<std::string, std::vector<TextEdit>>;
48 {std::move(FileURI), std::move(Edits)},
53 .edit = std::move(WE),
60 boost::asio::post(Pool, std::move(Action));
#define CheckDefault(x)
Variant of CheckReturn, but returns default constructed CheckTy
Convert between LSP and nixf types.
Whether current platform treats paths case insensitively.
llvm::unique_function< void(llvm::Expected< T >)> Callback
lspserver::Range toLSPRange(llvm::StringRef Code, const nixf::LexerCursorRange &R)
Range range
The range for which the command was invoked.
TextDocumentIdentifier textDocument
The document in which the command was invoked.
static const llvm::StringLiteral QUICKFIX_KIND
bool overlap(const Range &RHS) const
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.