openpectus.lsp.model

Classes

MarkupContent

Representation of

Hover

Representation of

Position

Representation of

Range

Representation of

Diagnostic

Representation of

TextEdit

Representation of

WorkspaceEdit

Representation of

CodeAction

Representation of

CodeActionContext

Representation of

DocumentSymbol

Representation of

Location

Representation of

SymbolInformation

Representation of

Command

Representation of

CompletionItem

Representation of

Functions

get_item_severity(item)

Represent analyzer item type as lsp DiagnosticSeverity

get_item_range(item)

Represent item position range as lsp RangeItem

Module Contents

class openpectus.lsp.model.MarkupContent

Bases: TypedDict

Representation of https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#markupContentInnerDefinition

kind: Literal['markdown', 'plaintext']
value: str
class openpectus.lsp.model.Hover

Bases: TypedDict

Representation of https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#hover

contents: MarkupContent
range: NotRequired[Range]
class openpectus.lsp.model.Position

Bases: TypedDict

Representation of https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#position

line: int

Zero-based line counter

character: int

Zero based character counter

class openpectus.lsp.model.Range

Bases: TypedDict

Representation of https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#range

Note: - Lines are zero-based - Characters are zero-based

start: Position
end: Position
class openpectus.lsp.model.Diagnostic

Bases: TypedDict

Representation of https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#diagnostic

range: Range
severity: NotRequired[int]
code: NotRequired[str]
source: NotRequired[str]
message: str
data: NotRequired[dict[str, str]]

One of DiagnosticSeverity

class openpectus.lsp.model.TextEdit

Bases: TypedDict

Representation of https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textEdit

range: Range
newText: str
class openpectus.lsp.model.WorkspaceEdit

Bases: TypedDict

Representation of https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#workspaceEdit

changes: dict[str, list[TextEdit]]
class openpectus.lsp.model.CodeAction

Bases: TypedDict

Representation of https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#codeAction

title: str
kind: NotRequired[Literal['', 'quickfix', 'refactor', 'refactor.extract', 'refactor.inline', 'refactor.rewrite', 'source', 'source.fixAll']]
diagnostics: NotRequired[list[Diagnostic]]
edit: NotRequired[WorkspaceEdit]
class openpectus.lsp.model.CodeActionContext

Bases: TypedDict

Representation of https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#codeActionContext

diagnostics: list[Diagnostic]
class openpectus.lsp.model.DocumentSymbol

Bases: TypedDict

Representation of https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#documentSymbol

name: str
kind: int
range: Range
selectionRange: Range
children: list[DocumentSymbol]
class openpectus.lsp.model.Location

Bases: TypedDict

Representation of https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#location

uri: str
range: Range
class openpectus.lsp.model.SymbolInformation

Bases: TypedDict

Representation of https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#symbolInformation

name: str
kind: int
location: Location
class openpectus.lsp.model.Command

Bases: TypedDict

Representation of https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#command

title: str
command: str
class openpectus.lsp.model.CompletionItem

Bases: TypedDict

Representation of https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#completionItem

label: str
kind: NotRequired[int]
preselect: NotRequired[bool]
insertText: NotRequired[str]
textEdit: NotRequired[TextEdit]
command: NotRequired[Command | None]
openpectus.lsp.model.get_item_severity(item)

Represent analyzer item type as lsp DiagnosticSeverity

Parameters:

item (openpectus.lang.exec.analyzer.AnalyzerItem)

Return type:

int

openpectus.lsp.model.get_item_range(item)

Represent item position range as lsp RangeItem

Parameters:

item (openpectus.lang.exec.analyzer.AnalyzerItem)

Return type:

Range