9#ifndef LIB_MLIR_TOOLS_MLIRLSPSERVER_SERVER_H_
10#define LIB_MLIR_TOOLS_MLIRLSPSERVER_SERVER_H_
15#include "llvm/Support/Error.h"
23using llvm::lsp::CodeAction;
24using llvm::lsp::CodeActionContext;
25using llvm::lsp::CompletionList;
26using llvm::lsp::Diagnostic;
27using llvm::lsp::DocumentSymbol;
28using llvm::lsp::Hover;
29using llvm::lsp::Location;
30using llvm::lsp::MLIRConvertBytecodeResult;
31using llvm::lsp::Position;
32using llvm::lsp::Range;
33using 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;
The DialectRegistry maps a dialect namespace to a constructor for the matching dialect.
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.
llvm::function_ref< DialectRegistry &(const llvm::lsp::URIForFile &uri)> DialectRegistryFn
Include the generated interface declarations.
Represents a range (offset, size, and stride) where each element of the triple may be dynamic or stat...