MLIR  22.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 (DialectRegistryFn registry_fn)
 Construct a new server with the given dialect registry function. 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< 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. 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 38 of file MLIRServer.h.

Constructor & Destructor Documentation

◆ MLIRServer()

lsp::MLIRServer::MLIRServer ( lsp::DialectRegistryFn  registry_fn)

Construct a new server with the given dialect registry function.

Definition at line 1285 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 1289 of file MLIRServer.cpp.

◆ convertFromBytecode()

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

Convert the given bytecode file to the textual format.

Definition at line 1355 of file MLIRServer.cpp.

References mlir::MLIRContext::allowUnregisteredDialects(), diag(), mlir::remark::failed(), mlir::Block::front(), and mlir::parseSourceFile().

◆ convertToBytecode()

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

Convert the given textual file to the bytecode format.

Definition at line 1406 of file MLIRServer.cpp.

◆ 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 1330 of file MLIRServer.cpp.

◆ 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 1322 of file MLIRServer.cpp.

◆ 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 1314 of file MLIRServer.cpp.

◆ 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 1346 of file MLIRServer.cpp.

◆ 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 1338 of file MLIRServer.cpp.

◆ 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 1306 of file MLIRServer.cpp.

◆ 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 1296 of file MLIRServer.cpp.


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