23#ifndef LLVM_SUPPORT_LSP_PROTOCOL_H
24#define LLVM_SUPPORT_LSP_PROTOCOL_H
122 explicit operator bool()
const {
return !filePath.empty(); }
125 return lhs.filePath == rhs.filePath;
128 return !(lhs == rhs);
131 return lhs.filePath < rhs.filePath;
140 explicit URIForFile(std::string &&filePath, std::string &&uriStr)
141 : filePath(
std::
move(filePath)), uriStr(uriStr) {}
143 std::string filePath;
151raw_ostream &
operator<<(raw_ostream &os,
const URIForFile &value);
295 line = lineAndCol.first - 1;
310 return !(lhs == rhs);
358 return !(lhs == rhs);
378 return SMRange(startLoc, endLoc);
409 return !(lhs == rhs);
495 std::string &contents);
717 std::vector<DiagnosticTag>
tags;
1063 return !(lhs == rhs);
1199 std::map<std::string, std::vector<TextEdit>>
changes;
1254 assert(style.
empty() &&
"style modifiers for this type are not supported");
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
This file supports working with JSON data.
ConstantRange Range(APInt(BitWidth, Low), APInt(BitWidth, High))
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Base class for user error types.
Tagged union holding either a T or a Error.
Represents a location in source code.
constexpr const char * getPointer() const
constexpr bool isValid() const
Represents a range in source code.
This owns the files read by a parser, handles include stacks, and handles diagnostic wrangling.
unsigned getMainFileID() const
LLVM_ABI std::pair< unsigned, unsigned > getLineAndColumn(SMLoc Loc, unsigned BufferID=0) const
Find the line and column number for the specified location in the specified file.
LLVM_ABI SMLoc FindLocForLineAndColumn(unsigned BufferID, unsigned LineNo, unsigned ColNo)
Given a line and column number in a mapped buffer, turn it into an SMLoc.
A wrapper around a string literal that serves as a proxy for constructing global tables of StringRefs...
StringRef - Represent a constant reference to a string, i.e.
constexpr bool empty() const
empty - Check if the string is empty.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
A "cursor" marking a position within a Value.
A Value is an JSON value of unknown type.
void log(raw_ostream &os) const override
Print an error message to an output stream.
std::error_code convertToErrorCode() const override
Convert this error to a std::error_code.
LSPError(std::string message, ErrorCode code)
URI in "file" scheme for a file.
friend bool operator==(const URIForFile &lhs, const URIForFile &rhs)
static void registerSupportedScheme(StringRef scheme)
Register a supported URI scheme.
static llvm::Expected< URIForFile > fromFile(StringRef absoluteFilepath, StringRef scheme="file")
Try to build a URIForFile from the given absolute file path and optional scheme.
static llvm::Expected< URIForFile > fromURI(StringRef uri)
Try to build a URIForFile from the given URI string.
StringRef scheme() const
Return the scheme of the uri.
friend bool operator!=(const URIForFile &lhs, const URIForFile &rhs)
StringRef uri() const
Returns the original uri of the file.
friend bool operator<(const URIForFile &lhs, const URIForFile &rhs)
StringRef file() const
Returns the absolute path to the file.
This class implements an extremely fast bulk output stream that can only output to a stream.
constexpr auto kCompletionItemKindMin
MarkupKind
Describes the content type that a client supports in various result literals like Hover.
llvm::json::Value toJSON(const URIForFile &value)
Add support for JSON serialization.
@ Invoked
Completion was triggered by typing an identifier (24x7 code complete), manual invocation (e....
@ TriggerTriggerForIncompleteCompletions
Completion was re-triggered as the current completion list is incomplete.
@ TriggerCharacter
Completion was triggered by a trigger character specified by the triggerCharacters properties of the ...
TextDocumentSyncKind
Defines how the host (editor) should sync document changes to the language server.
@ Incremental
Documents are synced by sending the full content on open.
@ None
Documents should not be synced at all.
@ Full
Documents are synced by always sending the full content of the document.
bool operator<(const CompletionItem &lhs, const CompletionItem &rhs)
bool operator==(const TextEdit &lhs, const TextEdit &rhs)
NoParams InitializedParams
raw_ostream & operator<<(raw_ostream &os, const URIForFile &value)
CompletionItemKind adjustKindToCapability(CompletionItemKind kind, CompletionItemKindBitset &supportedCompletionItemKinds)
InlayHintKind
Inlay hint kinds.
@ Parameter
An inlay hint that is for a parameter.
@ Type
An inlay hint that for a type annotation.
@ Undetermined
It is up to the client to interpret diagnostics as error, warning, info or hint.
InsertTextFormat
Defines whether the insert text in a completion item should be interpreted as plain text or a snippet...
std::bitset< kCompletionItemKindMax+1 > CompletionItemKindBitset
constexpr auto kCompletionItemKindMax
CompletionItemKind
The kind of a completion entry.
bool fromJSON(const llvm::json::Value &value, URIForFile &result, llvm::json::Path path)
This is an optimization pass for GlobalISel generic memory operations.
LLVM_ABI std::error_code inconvertibleErrorCode()
The value returned by this function can be returned from convertToErrorCode for Error values where no...
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
Implement std::hash so that hash_code can be used in STL containers.
This class represents an efficient way to signal success or failure.
bool hierarchicalDocumentSymbol
Client supports hierarchical document symbols.
bool workDoneProgress
Client supports server-initiated progress via the window/workDoneProgress/create method.
bool codeActionStructure
Client supports CodeAction return value for textDocument/codeAction.
std::string name
The name of the client as defined by the client.
std::optional< std::string > version
The client's version as defined by the client.
std::vector< Diagnostic > diagnostics
An array of diagnostics known on the client side overlapping the range provided to the textDocument/c...
std::vector< std::string > only
Requested kind of actions to return.
CodeActionContext context
Context carrying additional information.
TextDocumentIdentifier textDocument
The document in which the command was invoked.
Range range
The range for which the command was invoked.
A code action represents a change that can be performed in code, e.g.
std::optional< std::string > kind
The kind of the code action.
static const llvm::StringLiteral kRefactor
static const llvm::StringLiteral kInfo
bool isPreferred
Marks this as a preferred action.
static const llvm::StringLiteral kQuickFix
std::optional< std::vector< Diagnostic > > diagnostics
The diagnostics that this code action resolves.
std::optional< WorkspaceEdit > edit
The workspace edit this code action performs.
std::string title
A short, human-readable, title for this code action.
std::string triggerCharacter
The trigger character (a single character) that has trigger code complete.
CompletionTriggerKind triggerKind
How the completion was triggered.
CompletionItem(const Twine &label, CompletionItemKind kind, StringRef sortText="")
std::string filterText
A string that should be used when filtering a set of completion items.
std::string insertText
A string that should be inserted to a document when selecting this completion.
bool deprecated
Indicates if this item is deprecated.
std::optional< TextEdit > textEdit
An edit which is applied to a document when selecting this completion.
std::vector< TextEdit > additionalTextEdits
An optional array of additional text edits that are applied when selecting this completion.
CompletionItemKind kind
The kind of this completion item.
InsertTextFormat insertTextFormat
The format of the insert text.
std::string label
The label of this completion item.
std::optional< MarkupContent > documentation
A human-readable string that represents a doc-comment.
std::string sortText
A string that should be used when comparing this item with other items.
Represents a collection of completion items to be presented in the editor.
bool isIncomplete
The list is not complete.
std::vector< CompletionItem > items
The completion items.
CompletionContext context
std::vector< DiagnosticTag > tags
Additional metadata about the diagnostic.
std::string message
The diagnostic's message.
Range range
The source range where the message applies.
std::optional< std::vector< DiagnosticRelatedInformation > > relatedInformation
An array of related diagnostic information, e.g.
std::string source
A human-readable string describing the source of this diagnostic, e.g.
DiagnosticSeverity severity
The diagnostic's severity.
std::optional< std::string > category
The diagnostic's category.
VersionedTextDocumentIdentifier textDocument
The document that changed.
std::vector< TextDocumentContentChangeEvent > contentChanges
The actual content changes.
TextDocumentIdentifier textDocument
The document that was closed.
TextDocumentItem textDocument
The document that was opened.
Parameters for the document link request.
TextDocumentIdentifier textDocument
The document to provide document links for.
friend bool operator!=(const DocumentLink &lhs, const DocumentLink &rhs)
URIForFile target
The uri this link points to. If missing a resolve request is sent later.
DocumentLink(Range range, URIForFile target)
Range range
The range this link applies to.
friend bool operator==(const DocumentLink &lhs, const DocumentLink &rhs)
TextDocumentIdentifier textDocument
Represents programming constructs like variables, classes, interfaces etc.
Range range
The range enclosing this symbol not including leading/trailing whitespace but everything else like co...
SymbolKind kind
The kind of this symbol.
DocumentSymbol(const Twine &name, SymbolKind kind, Range range, Range selectionRange)
std::string name
The name of this symbol.
DocumentSymbol(DocumentSymbol &&)=default
std::vector< DocumentSymbol > children
Children of this symbol, e.g. properties of a class.
Range selectionRange
The range that should be selected and revealed when this symbol is being picked, e....
std::optional< Range > range
An optional range is a range inside a text document that is used to visualize a hover,...
Hover(Range range)
Construct a default hover with the given range that uses Markdown content.
MarkupContent contents
The hover's content.
std::optional< TraceLevel > trace
The initial trace setting. If omitted trace is disabled ('off').
ClientCapabilities capabilities
The capabilities provided by the client (editor or tool).
std::optional< ClientInfo > clientInfo
Information about the client.
bool paddingRight
Render padding after the hint.
InlayHint(InlayHintKind kind, Position pos)
bool paddingLeft
Render padding before the hint.
InlayHintKind kind
The kind of this hint.
std::string label
The label of this hint.
Position position
The position of this hint.
A parameter literal used in inlay hint requests.
Range range
The visible document range for which inlay hints should be computed.
TextDocumentIdentifier textDocument
The text document.
Location(const URIForFile &uri, Range range)
friend bool operator<(const Location &lhs, const Location &rhs)
friend bool operator!=(const Location &lhs, const Location &rhs)
URIForFile uri
The text document's URI.
Location(const URIForFile &uri, llvm::SourceMgr &mgr, SMRange range)
Construct a Location from the given source range.
friend bool operator==(const Location &lhs, const Location &rhs)
Position(llvm::SourceMgr &mgr, SMLoc loc)
Construct a position from the given source location.
int line
Line position in a document (zero-based).
SMLoc getAsSMLoc(llvm::SourceMgr &mgr) const
Convert this position into a source location in the main file of the given source manager.
friend bool operator==(const Position &lhs, const Position &rhs)
Position(int line=0, int character=0)
int character
Character offset on a line in a document (zero-based).
friend bool operator<(const Position &lhs, const Position &rhs)
friend bool operator<=(const Position &lhs, const Position &rhs)
friend bool operator!=(const Position &lhs, const Position &rhs)
URIForFile uri
The URI for which diagnostic information is reported.
PublishDiagnosticsParams(URIForFile uri, int64_t version)
int64_t version
The version number of the document the diagnostics are published for.
std::vector< Diagnostic > diagnostics
The list of reported diagnostics.
bool contains(Position pos) const
friend bool operator!=(const Range &lhs, const Range &rhs)
SMRange getAsSMRange(llvm::SourceMgr &mgr) const
Convert this range into a source range in the main file of the given source manager.
friend bool operator<(const Range &lhs, const Range &rhs)
bool contains(Range range) const
Position end
The range's end position.
Position start
The range's start position.
Range(llvm::SourceMgr &mgr, SMRange range)
Construct a range from the given source range.
Range(Position start, Position end)
friend bool operator==(const Range &lhs, const Range &rhs)
bool includeDeclaration
Include the declaration of the current symbol.
Represents the signature of a callable.
std::vector< SignatureInformation > signatures
The resulting signatures.
int activeParameter
The active parameter of the active signature.
int activeSignature
The active signature.
std::optional< Range > range
The range of the document that changed.
std::optional< int > rangeLength
The length of the range that got replaced.
LogicalResult applyTo(std::string &contents) const
Try to apply this change to the given contents string.
std::string text
The new text of the range/document.
URIForFile uri
The text document's URI.
std::string languageId
The text document's language identifier.
URIForFile uri
The text document's URI.
int64_t version
The version number of this document.
std::string text
The content of the opened text document.
Position position
The position inside the text document.
TextDocumentIdentifier textDocument
The text document.
Range range
The range of the text document to be manipulated.
std::string newText
The string to be inserted.
URIForFile uri
The text document's URI.
int64_t version
The version number of this document.
std::map< std::string, std::vector< TextEdit > > changes
Holds changes to existing resources.