MLIR  20.0.0git
Classes | Public Member Functions | List of all members
mlir::lsp::MLIRServer Class Reference

This class implements all of the MLIR related functionality necessary for a language server. More...

#include "Tools/mlir-lsp-server/MLIRServer.h"

Classes

struct  Impl
 

Public Member Functions

 MLIRServer (DialectRegistry &registry)
 Construct a new server with the given dialect regitstry. More...
 
 ~MLIRServer ()
 
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. More...
 
std::optional< int64_t > removeDocument (const URIForFile &uri)
 Remove the document with the given uri. More...
 
void getLocationsOf (const URIForFile &uri, const Position &defPos, std::vector< Location > &locations)
 Return the locations of the object pointed at by the given position. More...
 
void findReferencesOf (const URIForFile &uri, const Position &pos, std::vector< Location > &references)
 Find all references of the object pointed at by the given position. More...
 
std::optional< HoverfindHover (const URIForFile &uri, const Position &hoverPos)
 Find a hover description for the given hover position, or std::nullopt if one couldn't be found. More...
 
void findDocumentSymbols (const URIForFile &uri, std::vector< DocumentSymbol > &symbols)
 Find all of the document symbols within the given file. More...
 
CompletionList getCodeCompletion (const URIForFile &uri, const Position &completePos)
 Get the code completion list for the position within the given file. More...
 
void getCodeActions (const URIForFile &uri, const Range &pos, const CodeActionContext &context, std::vector< CodeAction > &actions)
 Get the set of code actions within the file. More...
 
llvm::Expected< MLIRConvertBytecodeResultconvertFromBytecode (const URIForFile &uri)
 Convert the given bytecode file to the textual format. More...
 
llvm::Expected< MLIRConvertBytecodeResultconvertToBytecode (const URIForFile &uri)
 Convert the given textual file to the bytecode format. More...
 

Detailed Description

This class implements all of the MLIR related functionality necessary for a language server.

This class allows for keeping the MLIR specific logic separate from the logic that involves LSP server/client communication.

Definition at line 36 of file MLIRServer.h.

Constructor & Destructor Documentation

◆ MLIRServer()

lsp::MLIRServer::MLIRServer ( DialectRegistry registry)

Construct a new server with the given dialect regitstry.

Definition at line 1280 of file MLIRServer.cpp.

◆ ~MLIRServer()

lsp::MLIRServer::~MLIRServer ( )
default

Member Function Documentation

◆ addOrUpdateDocument()

void lsp::MLIRServer::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.

Any diagnostics emitted for this document should be added to diagnostics.

Definition at line 1284 of file MLIRServer.cpp.

References mlir::lsp::URIForFile::file().

◆ convertFromBytecode()

llvm::Expected< lsp::MLIRConvertBytecodeResult > lsp::MLIRServer::convertFromBytecode ( const URIForFile uri)

Convert the given bytecode file to the textual format.

Definition at line 1350 of file MLIRServer.cpp.

References mlir::MLIRContext::allowUnregisteredDialects(), diag(), mlir::lsp::URIForFile::file(), mlir::Block::front(), mlir::parseSourceFile(), and mlir::lsp::RequestFailed.

◆ convertToBytecode()

llvm::Expected< lsp::MLIRConvertBytecodeResult > lsp::MLIRServer::convertToBytecode ( const URIForFile uri)

Convert the given textual file to the bytecode format.

Definition at line 1401 of file MLIRServer.cpp.

References mlir::lsp::URIForFile::file(), and mlir::lsp::RequestFailed.

◆ findDocumentSymbols()

void lsp::MLIRServer::findDocumentSymbols ( const URIForFile uri,
std::vector< DocumentSymbol > &  symbols 
)

Find all of the document symbols within the given file.

Definition at line 1325 of file MLIRServer.cpp.

References mlir::lsp::URIForFile::file().

◆ findHover()

std::optional< lsp::Hover > lsp::MLIRServer::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.

Definition at line 1317 of file MLIRServer.cpp.

References mlir::lsp::URIForFile::file().

◆ findReferencesOf()

void lsp::MLIRServer::findReferencesOf ( const URIForFile uri,
const Position pos,
std::vector< Location > &  references 
)

Find all references of the object pointed at by the given position.

Definition at line 1309 of file MLIRServer.cpp.

References mlir::lsp::URIForFile::file().

◆ getCodeActions()

void lsp::MLIRServer::getCodeActions ( const URIForFile uri,
const Range pos,
const CodeActionContext context,
std::vector< CodeAction > &  actions 
)

Get the set of code actions within the file.

Definition at line 1341 of file MLIRServer.cpp.

References mlir::lsp::URIForFile::file().

◆ getCodeCompletion()

lsp::CompletionList lsp::MLIRServer::getCodeCompletion ( const URIForFile uri,
const Position completePos 
)

Get the code completion list for the position within the given file.

Definition at line 1333 of file MLIRServer.cpp.

References mlir::lsp::URIForFile::file().

◆ getLocationsOf()

void lsp::MLIRServer::getLocationsOf ( const URIForFile uri,
const Position defPos,
std::vector< Location > &  locations 
)

Return the locations of the object pointed at by the given position.

Definition at line 1301 of file MLIRServer.cpp.

References mlir::lsp::URIForFile::file().

◆ removeDocument()

std::optional< int64_t > lsp::MLIRServer::removeDocument ( const URIForFile uri)

Remove the document with the given uri.

Returns the version of the removed document, or std::nullopt if the uri did not have a corresponding document within the server.

Definition at line 1291 of file MLIRServer.cpp.

References mlir::lsp::URIForFile::file().


The documentation for this class was generated from the following files: