9 #ifndef LIB_MLIR_TOOLS_MLIRLSPSERVER_SERVER_H_
10 #define LIB_MLIR_TOOLS_MLIRLSPSERVER_SERVER_H_
15 #include "llvm/Support/Error.h"
20 class DialectRegistry;
23 using llvm::lsp::CodeAction;
24 using llvm::lsp::CodeActionContext;
25 using llvm::lsp::CompletionList;
26 using llvm::lsp::Diagnostic;
27 using llvm::lsp::DocumentSymbol;
28 using llvm::lsp::Hover;
29 using llvm::lsp::Location;
31 using llvm::lsp::Position;
32 using llvm::lsp::Range;
33 using llvm::lsp::URIForFile;
49 std::vector<Diagnostic> &diagnostics);
58 std::vector<Location> &locations);
62 std::vector<Location> &references);
66 std::optional<Hover>
findHover(
const URIForFile &uri,
67 const Position &hoverPos);
71 std::vector<DocumentSymbol> &symbols);
75 const Position &completePos);
79 const CodeActionContext &context,
80 std::vector<CodeAction> &actions);
93 std::unique_ptr<Impl>
impl;
This class implements all of the MLIR related functionality necessary for a language server.
void addOrUpdateDocument(const URIForFile &uri, StringRef contents, int64_t version, std::vector< Diagnostic > &diagnostics)
Add or update the document, with the provided version, at the given URI.
std::optional< int64_t > removeDocument(const URIForFile &uri)
Remove the document with the given uri.
void findReferencesOf(const URIForFile &uri, const Position &pos, std::vector< Location > &references)
Find all references of the object pointed at by the given position.
void getLocationsOf(const URIForFile &uri, const Position &defPos, std::vector< Location > &locations)
Return the locations of the object pointed at by the given position.
std::optional< Hover > findHover(const URIForFile &uri, const Position &hoverPos)
Find a hover description for the given hover position, or std::nullopt if one couldn't be found.
llvm::Expected< MLIRConvertBytecodeResult > convertFromBytecode(const URIForFile &uri)
Convert the given bytecode file to the textual format.
llvm::Expected< MLIRConvertBytecodeResult > convertToBytecode(const URIForFile &uri)
Convert the given textual file to the bytecode format.
CompletionList getCodeCompletion(const URIForFile &uri, const Position &completePos)
Get the code completion list for the position within the given file.
void findDocumentSymbols(const URIForFile &uri, std::vector< DocumentSymbol > &symbols)
Find all of the document symbols within the given file.
MLIRServer(DialectRegistryFn registry_fn)
Construct a new server with the given dialect registry function.
void getCodeActions(const URIForFile &uri, const Range &pos, const CodeActionContext &context, std::vector< CodeAction > &actions)
Get the set of code actions within the file.
Include the generated interface declarations.
This class represents the result of converting between MLIR's bytecode and textual format.