# lsp.py - Language Server Protocol data structures and support functions
#
# Copyright 2024 by Eckhart Arnold (arnold@badw.de)
# Bavarian Academy of Sciences an Humanities (badw.de)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied. See the License for the specific language governing
# permissions and limitations under the License.
"""Module lsp.py defines (some of) the constants and data structures from
the Language Server Protocol. See:
<https://microsoft.github.io/language-server-protocol/specifications/specification-current/>
EXPERIMENTAL!!!
"""
from __future__ import annotations
import bisect
from enum import Enum, IntEnum
import sys
assert sys.version_info >= (3, 7), "Python 3.7 or newer is required."
from typing import Union, List, Tuple, Optional, Dict, Any, \
Iterator, Iterable, Callable
if sys.version_info >= (3, 9, 0):
from typing import Union, Optional, Any, Generic, TypeVar, Callable, List, Tuple, Dict
# do not use list, tuple, dict, because contained types won't be forward ref'd
from collections.abc import Coroutine
else:
from typing import Union, List, Tuple, Optional, Dict, Any, Generic, TypeVar, Callable, Coroutine
try:
from DHParser.ts2python.typeddict_shim import TypedDict, GenericTypedDict, NotRequired, Literal
# Overwrite typing.TypedDict for Runtime-Validation
except ImportError:
print("Module ts2python.typeddict_shim not found. Only coarse-grained "
"runtime type-validation of TypedDicts possible")
try:
from typing import TypedDict, Literal
except ImportError:
try:
from DHParser.ts2python.typing_extensions import TypedDict, Literal
except ImportError:
print(f'Please install the "typing_extensions" module via the shell '
f'command "# pip install typing_extensions" before running '
f'{__file__} with Python-versions <= 3.11!')
GenericMeta = type
class _GenericTypedDictMeta(GenericMeta):
def __new__(cls, name, bases, ns, total=True):
return type.__new__(_GenericTypedDictMeta, name, (dict,), ns)
__call__ = dict
GenericTypedDict = _GenericTypedDictMeta('TypedDict', (dict,), {})
GenericTypedDict.__module__ = __name__
try:
from DHParser.ts2python.singledispatch_shim import singledispatch, singledispatchmethod
except ImportError:
print("ts2python.singledispatch_shim not found! @singledispatch-annotation"
" imported from functools may cause NameErrors on forward-referenced"
" types.")
try:
from functools import singledispatch, singledispatchmethod
except ImportError:
print(f"functools.singledispatchmethod does not exist in Python Version "
f"{sys.version}. This module may therefore fail to run if "
f"singledispatchmethod is needed, anywhere!")
# from DHParser.json_validation import validate_type, type_check, TypedDict
#######################################################################
#
# Language-Server-Protocol functions
#
#######################################################################
# general #############################################################
# def get_lsp_methods(cls: Any, prefix: str= 'lsp_') -> List[str]:
# """Returns the language-server-protocol-method-names from class ``cls``.
# Methods are selected based on the prefix and their name converted in
# accordance with the LSP-specification."""
# return [gen_lsp_name(fn, prefix) for fn in lsp_candidates(cls, prefix)]
[docs]
def lsp_candidates(cls: Any, prefix: str = 'lsp_') -> Iterator[str]:
"""Returns an iterator over all method names from a class that either
have a certain prefix or, if no prefix was given, all non-special and
non-private-methods of the class."""
assert not prefix[:1] == '_'
if prefix:
# return [fn for fn in dir(cls) if fn.startswith(prefix) and callable(getattr(cls, fn))]
for fn in dir(cls):
if fn[:len(prefix)] == prefix and callable(getattr(cls, fn)):
yield fn
else:
# return [fn for fn in dir(cls) if not fn.startswith('_') and callable(getattr(cls, fn))]
for fn in dir(cls):
if not fn[:1] == '_' and callable(getattr(cls, fn)):
yield fn
[docs]
def gen_lsp_name(func_name: str, prefix: str = 'lsp_') -> str:
"""Generates the name of an lsp-method from a function name,
e.g. "lsp_S_cancelRequest" -> "$/cancelRequest" """
assert func_name[:len(prefix)] == prefix
return func_name[len(prefix):].replace('_', '/').replace('S/', '$/')
[docs]
def gen_lsp_table(lsp_funcs_or_instance: Union[Iterable[Callable], Any],
prefix: str = 'lsp_') -> Dict[str, Callable]:
"""Creates an RPC from a list of functions or from the methods
of a class that implement the language server protocol.
The dictionary keys are derived from the function name by replacing an
underscore _ with a slash / and a single capital S with a $-sign.
if ``prefix`` is not the empty string only functions or methods that start
with ``prefix`` will be added to the table. The prefix will be removed
before converting the functions' name to a dictionary key.
>>> class LSP:
... def lsp_initialize(self, **kw):
... pass # return InitializeResult
... def lsp_shutdown(self, **kw):
... pass
>>> lsp = LSP()
>>> gen_lsp_table(lsp, 'lsp_').keys()
dict_keys(['initialize', 'shutdown'])
"""
if isinstance(lsp_funcs_or_instance, Iterable):
assert all(callable(func) for func in lsp_funcs_or_instance)
rpc_table = {gen_lsp_name(func.__name__, prefix): func for func in lsp_funcs_or_instance}
else:
# assume lsp_funcs_or_instance is the instance of a class
cls = lsp_funcs_or_instance
rpc_table = {gen_lsp_name(fn, prefix): getattr(cls, fn)
for fn in lsp_candidates(cls, prefix)}
return rpc_table
# textDocument/completion #############################################
def shortlist(long_list: List[str], typed: str, lo: int = 0, hi: int = -1) -> Tuple[int, int]:
if not typed:
return 0, 0
if hi < 0:
hi = len(long_list)
a = bisect.bisect_left(long_list, typed, lo, hi)
b = bisect.bisect_left(long_list, typed[:-1] + chr(ord(typed[-1]) + 1), lo, hi)
return a, b
#######################################################################
#
# Language-Server-Protocol data structures (AUTOGENERATED: Don't edit!)
#
#######################################################################
##### BEGIN OF LSP SPECS
integer = float
uinteger = float
decimal = float
LSPAny = Union['LSPObject', 'LSPArray', str, int, float, bool, None]
LSPObject = Dict[str, LSPAny]
LSPArray = List[LSPAny]
[docs]
class Message(TypedDict, total=True):
jsonrpc: str
[docs]
class RequestMessage(Message, TypedDict, total=False):
id: Union[int, str]
method: str
params: Union[List, Dict, None]
[docs]
class ResponseMessage(Message, TypedDict, total=False):
id: Union[int, str, None]
result: Optional[LSPAny]
error: Optional['ResponseError']
[docs]
class ResponseError(TypedDict, total=False):
code: int
message: str
data: Optional[LSPAny]
[docs]
class ErrorCodes(IntEnum):
ParseError = -32700
InvalidRequest = -32600
MethodNotFound = -32601
InvalidParams = -32602
InternalError = -32603
jsonrpcReservedErrorRangeStart = -32099
serverErrorStart = jsonrpcReservedErrorRangeStart
ServerNotInitialized = -32002
UnknownErrorCode = -32001
jsonrpcReservedErrorRangeEnd = -32000
serverErrorEnd = jsonrpcReservedErrorRangeEnd
lspReservedErrorRangeStart = -32899
RequestFailed = -32803
ServerCancelled = -32802
ContentModified = -32801
RequestCancelled = -32800
lspReservedErrorRangeEnd = -32800
[docs]
class NotificationMessage(Message, TypedDict, total=False):
method: str
params: Union[List, Dict, None]
[docs]
class CancelParams(TypedDict, total=True):
id: Union[int, str]
ProgressToken = Union[int, str]
T = TypeVar('T')
[docs]
class ProgressParams(Generic[T], GenericTypedDict, total=True):
token: ProgressToken
value: T
class HoverParams(TypedDict, total=True):
class Position_0(TypedDict, total=True):
line: int
character: int
textDocument: str
position: Position_0
[docs]
class HoverResult(TypedDict, total=True):
value: str
DocumentUri = str
URI = str
[docs]
class RegularExpressionsClientCapabilities(TypedDict, total=False):
engine: str
version: Optional[str]
EOL: List[str] = ['\n', '\r\n', '\r']
[docs]
class Position(TypedDict, total=True):
line: int
character: int
PositionEncodingKind = str
[docs]
class PositionEncodingKind(Enum):
UTF8 = 'utf-8'
UTF16 = 'utf-16'
UTF32 = 'utf-32'
[docs]
class Range(TypedDict, total=True):
start: Position
end: Position
[docs]
class TextDocumentItem(TypedDict, total=True):
uri: DocumentUri
languageId: str
version: int
text: str
[docs]
class TextDocumentIdentifier(TypedDict, total=True):
uri: DocumentUri
[docs]
class VersionedTextDocumentIdentifier(TextDocumentIdentifier, TypedDict, total=True):
version: int
[docs]
class OptionalVersionedTextDocumentIdentifier(TextDocumentIdentifier, TypedDict, total=True):
version: Union[int, None]
[docs]
class TextDocumentPositionParams(TypedDict, total=True):
textDocument: TextDocumentIdentifier
position: Position
[docs]
class DocumentFilter(TypedDict, total=False):
language: Optional[str]
scheme: Optional[str]
pattern: Optional[str]
DocumentSelector = List[DocumentFilter]
[docs]
class StringValue(TypedDict, total=True):
kind: str
value: str
[docs]
class TextEdit(TypedDict, total=True):
range: Range
newText: str
[docs]
class ChangeAnnotation(TypedDict, total=False):
label: str
needsConfirmation: Optional[bool]
description: Optional[str]
ChangeAnnotationIdentifier = str
[docs]
class AnnotatedTextEdit(TextEdit, TypedDict, total=True):
annotationId: ChangeAnnotationIdentifier
[docs]
class SnippetTextEdit(TypedDict, total=False):
range: Range
snippet: StringValue
annotationId: Optional[ChangeAnnotationIdentifier]
[docs]
class TextDocumentEdit(TypedDict, total=True):
textDocument: OptionalVersionedTextDocumentIdentifier
edits: List[Union[TextEdit, AnnotatedTextEdit, SnippetTextEdit]]
[docs]
class Location(TypedDict, total=True):
uri: DocumentUri
range: Range
[docs]
class LocationLink(TypedDict, total=False):
originSelectionRange: Optional[Range]
targetUri: DocumentUri
targetRange: Range
targetSelectionRange: Range
[docs]
class Diagnostic(TypedDict, total=False):
range: Range
severity: Optional['DiagnosticSeverity']
code: Union[int, str, None]
codeDescription: Optional['CodeDescription']
source: Optional[str]
message: Union[str, 'MarkupContent']
tags: Optional[List['DiagnosticTag']]
relatedInformation: Optional[List['DiagnosticRelatedInformation']]
data: Optional[LSPAny]
[docs]
class DiagnosticSeverity(IntEnum):
Error = 1
Warning = 2
Information = 3
Hint = 4
# commented out, because there is already an enumeration with the same name
# DiagnosticSeverity = int
[docs]
class DiagnosticTag(IntEnum):
Unnecessary = 1
Deprecated = 2
# commented out, because there is already an enumeration with the same name
# DiagnosticTag = int
[docs]
class CodeDescription(TypedDict, total=True):
href: URI
[docs]
class Command(TypedDict, total=False):
title: str
tooltip: Optional[str]
command: str
arguments: Optional[List[LSPAny]]
[docs]
class MarkupKind(Enum):
PlainText = 'plaintext'
Markdown = 'markdown'
# commented out, because there is already an enumeration with the same name
# MarkupKind = str
[docs]
class MarkupContent(TypedDict, total=True):
kind: MarkupKind
value: str
[docs]
class MarkdownClientCapabilities(TypedDict, total=False):
parser: str
version: Optional[str]
allowedTags: Optional[List[str]]
[docs]
class CreateFileOptions(TypedDict, total=False):
overwrite: Optional[bool]
ignoreIfExists: Optional[bool]
[docs]
class CreateFile(TypedDict, total=False):
kind: str
uri: DocumentUri
options: Optional[CreateFileOptions]
annotationId: Optional[ChangeAnnotationIdentifier]
[docs]
class RenameFileOptions(TypedDict, total=False):
overwrite: Optional[bool]
ignoreIfExists: Optional[bool]
[docs]
class RenameFile(TypedDict, total=False):
kind: str
oldUri: DocumentUri
newUri: DocumentUri
options: Optional[RenameFileOptions]
annotationId: Optional[ChangeAnnotationIdentifier]
[docs]
class DeleteFileOptions(TypedDict, total=False):
recursive: Optional[bool]
ignoreIfNotExists: Optional[bool]
[docs]
class DeleteFile(TypedDict, total=False):
kind: str
uri: DocumentUri
options: Optional[DeleteFileOptions]
annotationId: Optional[ChangeAnnotationIdentifier]
[docs]
class WorkspaceEdit(TypedDict, total=False):
changes: Optional[Dict[DocumentUri, List[TextEdit]]]
documentChanges: Union[List[TextDocumentEdit], List[Union[TextDocumentEdit, CreateFile, RenameFile, DeleteFile]], None]
changeAnnotations: Optional[Dict[str, ChangeAnnotation]]
[docs]
class WorkspaceEditClientCapabilities(TypedDict, total=False):
[docs]
class ChangeAnnotationSupport_0(TypedDict, total=False):
groupsOnLabel: Optional[bool]
documentChanges: Optional[bool]
resourceOperations: Optional[List['ResourceOperationKind']]
failureHandling: Optional['FailureHandlingKind']
normalizesLineEndings: Optional[bool]
changeAnnotationSupport: Optional[ChangeAnnotationSupport_0]
metadataSupport: Optional[bool]
snippetEditSupport: Optional[bool]
ResourceOperationKind = str
[docs]
class ResourceOperationKind(Enum):
Create = 'create'
Rename = 'rename'
Delete = 'delete'
FailureHandlingKind = str
[docs]
class FailureHandlingKind(Enum):
Abort = 'abort'
Transactional = 'transactional'
TextOnlyTransactional = 'textOnlyTransactional'
Undo = 'undo'
[docs]
class WorkDoneProgressBegin(TypedDict, total=False):
kind: str
title: str
cancellable: Optional[bool]
message: Optional[str]
percentage: Optional[int]
[docs]
class WorkDoneProgressReport(TypedDict, total=False):
kind: str
cancellable: Optional[bool]
message: Optional[str]
percentage: Optional[int]
[docs]
class WorkDoneProgressEnd(TypedDict, total=False):
kind: str
message: Optional[str]
[docs]
class WorkDoneProgressParams(TypedDict, total=False):
workDoneToken: Optional[ProgressToken]
[docs]
class WorkDoneProgressOptions(TypedDict, total=False):
workDoneProgress: Optional[bool]
[docs]
class PartialResultParams(TypedDict, total=False):
partialResultToken: Optional[ProgressToken]
TraceValue = str
[docs]
class InitializeParams(WorkDoneProgressParams, TypedDict, total=False):
[docs]
class ClientInfo_0(TypedDict, total=False):
name: str
version: Optional[str]
processId: Union[int, None]
clientInfo: Optional[ClientInfo_0]
locale: Optional[str]
rootPath: Union[str, None]
rootUri: Union[DocumentUri, None]
initializationOptions: Optional[LSPAny]
capabilities: 'ClientCapabilities'
trace: Optional[TraceValue]
workspaceFolders: Union[List['WorkspaceFolder'], None]
[docs]
class TextDocumentClientCapabilities(TypedDict, total=False):
synchronization: Optional['TextDocumentSyncClientCapabilities']
completion: Optional['CompletionClientCapabilities']
hover: Optional['HoverClientCapabilities']
signatureHelp: Optional['SignatureHelpClientCapabilities']
declaration: Optional['DeclarationClientCapabilities']
definition: Optional['DefinitionClientCapabilities']
typeDefinition: Optional['TypeDefinitionClientCapabilities']
implementation: Optional['ImplementationClientCapabilities']
references: Optional['ReferenceClientCapabilities']
documentHighlight: Optional['DocumentHighlightClientCapabilities']
documentSymbol: Optional['DocumentSymbolClientCapabilities']
codeAction: Optional['CodeActionClientCapabilities']
codeLens: Optional['CodeLensClientCapabilities']
documentLink: Optional['DocumentLinkClientCapabilities']
colorProvider: Optional['DocumentColorClientCapabilities']
formatting: Optional['DocumentFormattingClientCapabilities']
rangeFormatting: Optional['DocumentRangeFormattingClientCapabilities']
onTypeFormatting: Optional['DocumentOnTypeFormattingClientCapabilities']
rename: Optional['RenameClientCapabilities']
publishDiagnostics: Optional['PublishDiagnosticsClientCapabilities']
foldingRange: Optional['FoldingRangeClientCapabilities']
selectionRange: Optional['SelectionRangeClientCapabilities']
linkedEditingRange: Optional['LinkedEditingRangeClientCapabilities']
callHierarchy: Optional['CallHierarchyClientCapabilities']
semanticTokens: Optional['SemanticTokensClientCapabilities']
moniker: Optional['MonikerClientCapabilities']
typeHierarchy: Optional['TypeHierarchyClientCapabilities']
inlineValue: Optional['InlineValueClientCapabilities']
inlayHint: Optional['InlayHintClientCapabilities']
diagnostic: Optional['DiagnosticClientCapabilities']
inlineCompletion: Optional['InlineCompletionClientCapabilities']
[docs]
class NotebookDocumentClientCapabilities(TypedDict, total=True):
synchronization: 'NotebookDocumentSyncClientCapabilities'
[docs]
class ClientCapabilities(TypedDict, total=False):
[docs]
class Workspace_0(TypedDict, total=False):
[docs]
class FileOperations_0(TypedDict, total=False):
dynamicRegistration: Optional[bool]
didCreate: Optional[bool]
willCreate: Optional[bool]
didRename: Optional[bool]
willRename: Optional[bool]
didDelete: Optional[bool]
willDelete: Optional[bool]
applyEdit: Optional[bool]
workspaceEdit: Optional[WorkspaceEditClientCapabilities]
didChangeConfiguration: Optional['DidChangeConfigurationClientCapabilities']
didChangeWatchedFiles: Optional['DidChangeWatchedFilesClientCapabilities']
symbol: Optional['WorkspaceSymbolClientCapabilities']
executeCommand: Optional['ExecuteCommandClientCapabilities']
workspaceFolders: Optional[bool]
configuration: Optional[bool]
semanticTokens: Optional['SemanticTokensWorkspaceClientCapabilities']
codeLens: Optional['CodeLensWorkspaceClientCapabilities']
fileOperations: Optional[FileOperations_0]
inlineValue: Optional['InlineValueWorkspaceClientCapabilities']
inlayHint: Optional['InlayHintWorkspaceClientCapabilities']
diagnostics: Optional['DiagnosticWorkspaceClientCapabilities']
[docs]
class Window_0(TypedDict, total=False):
workDoneProgress: Optional[bool]
showMessage: Optional['ShowMessageRequestClientCapabilities']
showDocument: Optional['ShowDocumentClientCapabilities']
[docs]
class General_0(TypedDict, total=False):
[docs]
class StaleRequestSupport_0(TypedDict, total=True):
cancel: bool
retryOnContentModified: List[str]
staleRequestSupport: Optional[StaleRequestSupport_0]
regularExpressions: Optional[RegularExpressionsClientCapabilities]
markdown: Optional[MarkdownClientCapabilities]
positionEncodings: Optional[List[PositionEncodingKind]]
workspace: Optional[Workspace_0]
textDocument: Optional[TextDocumentClientCapabilities]
notebookDocument: Optional[NotebookDocumentClientCapabilities]
window: Optional[Window_0]
general: Optional[General_0]
experimental: Optional[LSPAny]
[docs]
class InitializeResult(TypedDict, total=False):
[docs]
class ServerInfo_0(TypedDict, total=False):
name: str
version: Optional[str]
capabilities: 'ServerCapabilities'
serverInfo: Optional[ServerInfo_0]
[docs]
class InitializeErrorCodes(IntEnum):
unknownProtocolVersion = 1
# commented out, because there is already an enumeration with the same name
# InitializeErrorCodes = int
[docs]
class InitializeError(TypedDict, total=True):
retry: bool
[docs]
class ServerCapabilities(TypedDict, total=False):
[docs]
class TextDocument_0(TypedDict, total=False):
[docs]
class Diagnostic_0(TypedDict, total=False):
markupMessageSupport: Optional[bool]
diagnostic: Optional[Diagnostic_0]
[docs]
class Workspace_0(TypedDict, total=False):
[docs]
class FileOperations_0(TypedDict, total=False):
didCreate: Optional['FileOperationRegistrationOptions']
willCreate: Optional['FileOperationRegistrationOptions']
didRename: Optional['FileOperationRegistrationOptions']
willRename: Optional['FileOperationRegistrationOptions']
didDelete: Optional['FileOperationRegistrationOptions']
willDelete: Optional['FileOperationRegistrationOptions']
workspaceFolders: Optional['WorkspaceFoldersServerCapabilities']
fileOperations: Optional[FileOperations_0]
positionEncoding: Optional[PositionEncodingKind]
textDocumentSync: Union['TextDocumentSyncOptions', 'TextDocumentSyncKind', None]
notebookDocumentSync: Union['NotebookDocumentSyncOptions', 'NotebookDocumentSyncRegistrationOptions', None]
completionProvider: Optional['CompletionOptions']
hoverProvider: Union[bool, 'HoverOptions', None]
signatureHelpProvider: Optional['SignatureHelpOptions']
declarationProvider: Union[bool, 'DeclarationOptions', 'DeclarationRegistrationOptions', None]
definitionProvider: Union[bool, 'DefinitionOptions', None]
typeDefinitionProvider: Union[bool, 'TypeDefinitionOptions', 'TypeDefinitionRegistrationOptions', None]
implementationProvider: Union[bool, 'ImplementationOptions', 'ImplementationRegistrationOptions', None]
referencesProvider: Union[bool, 'ReferenceOptions', None]
documentHighlightProvider: Union[bool, 'DocumentHighlightOptions', None]
documentSymbolProvider: Union[bool, 'DocumentSymbolOptions', None]
codeActionProvider: Union[bool, 'CodeActionOptions', None]
codeLensProvider: Optional['CodeLensOptions']
documentLinkProvider: Optional['DocumentLinkOptions']
colorProvider: Union[bool, 'DocumentColorOptions', 'DocumentColorRegistrationOptions', None]
documentFormattingProvider: Union[bool, 'DocumentFormattingOptions', None]
documentRangeFormattingProvider: Union[bool, 'DocumentRangeFormattingOptions', None]
documentOnTypeFormattingProvider: Optional['DocumentOnTypeFormattingOptions']
renameProvider: Union[bool, 'RenameOptions', None]
foldingRangeProvider: Union[bool, 'FoldingRangeOptions', 'FoldingRangeRegistrationOptions', None]
executeCommandProvider: Optional['ExecuteCommandOptions']
selectionRangeProvider: Union[bool, 'SelectionRangeOptions', 'SelectionRangeRegistrationOptions', None]
linkedEditingRangeProvider: Union[bool, 'LinkedEditingRangeOptions', 'LinkedEditingRangeRegistrationOptions', None]
callHierarchyProvider: Union[bool, 'CallHierarchyOptions', 'CallHierarchyRegistrationOptions', None]
semanticTokensProvider: Union['SemanticTokensOptions', 'SemanticTokensRegistrationOptions', None]
monikerProvider: Union[bool, 'MonikerOptions', 'MonikerRegistrationOptions', None]
typeHierarchyProvider: Union[bool, 'TypeHierarchyOptions', 'TypeHierarchyRegistrationOptions', None]
inlineValueProvider: Union[bool, 'InlineValueOptions', 'InlineValueRegistrationOptions', None]
inlayHintProvider: Union[bool, 'InlayHintOptions', 'InlayHintRegistrationOptions', None]
diagnosticProvider: Union['DiagnosticOptions', 'DiagnosticRegistrationOptions', None]
workspaceSymbolProvider: Union[bool, 'WorkspaceSymbolOptions', None]
inlineCompletionProvider: Union[bool, 'InlineCompletionOptions', None]
textDocument: Optional[TextDocument_0]
workspace: Optional[Workspace_0]
experimental: Optional[LSPAny]
[docs]
class InitializedParams(TypedDict, total=True):
pass
[docs]
class Registration(TypedDict, total=False):
id: str
method: str
registerOptions: Optional[LSPAny]
[docs]
class RegistrationParams(TypedDict, total=True):
registrations: List[Registration]
[docs]
class StaticRegistrationOptions(TypedDict, total=False):
id: Optional[str]
[docs]
class TextDocumentRegistrationOptions(TypedDict, total=True):
documentSelector: Union[DocumentSelector, None]
[docs]
class Unregistration(TypedDict, total=True):
id: str
method: str
[docs]
class UnregistrationParams(TypedDict, total=True):
unregisterations: List[Unregistration]
[docs]
class SetTraceParams(TypedDict, total=True):
value: TraceValue
[docs]
class LogTraceParams(TypedDict, total=False):
message: str
verbose: Optional[str]
[docs]
class TextDocumentSyncKind(IntEnum):
None_ = 0
Full = 1
Incremental = 2
# commented out, because there is already an enumeration with the same name
# TextDocumentSyncKind = int
class TextDocumentSyncOptions(TypedDict, total=False):
openClose: Optional[bool]
change: Optional[TextDocumentSyncKind]
[docs]
class DidOpenTextDocumentParams(TypedDict, total=True):
textDocument: TextDocumentItem
[docs]
class TextDocumentChangeRegistrationOptions(TextDocumentRegistrationOptions, TypedDict, total=True):
syncKind: TextDocumentSyncKind
[docs]
class DidChangeTextDocumentParams(TypedDict, total=True):
textDocument: VersionedTextDocumentIdentifier
contentChanges: List['TextDocumentContentChangeEvent']
[docs]
class TextDocumentContentChangeEvent_0(TypedDict, total=False):
range: Range
rangeLength: Optional[int]
text: str
[docs]
class TextDocumentContentChangeEvent_1(TypedDict, total=True):
text: str
TextDocumentContentChangeEvent = Union[TextDocumentContentChangeEvent_0, TextDocumentContentChangeEvent_1]
[docs]
class WillSaveTextDocumentParams(TypedDict, total=True):
textDocument: TextDocumentIdentifier
reason: 'TextDocumentSaveReason'
[docs]
class TextDocumentSaveReason(IntEnum):
Manual = 1
AfterDelay = 2
FocusOut = 3
# commented out, because there is already an enumeration with the same name
# TextDocumentSaveReason = int
[docs]
class SaveOptions(TypedDict, total=False):
includeText: Optional[bool]
[docs]
class TextDocumentSaveRegistrationOptions(TextDocumentRegistrationOptions, TypedDict, total=False):
includeText: Optional[bool]
[docs]
class DidSaveTextDocumentParams(TypedDict, total=False):
textDocument: TextDocumentIdentifier
text: Optional[str]
[docs]
class DidCloseTextDocumentParams(TypedDict, total=True):
textDocument: TextDocumentIdentifier
[docs]
class TextDocumentSyncClientCapabilities(TypedDict, total=False):
dynamicRegistration: Optional[bool]
willSave: Optional[bool]
willSaveWaitUntil: Optional[bool]
didSave: Optional[bool]
[docs]
class TextDocumentSyncOptions(TypedDict, total=False):
openClose: Optional[bool]
change: Optional[TextDocumentSyncKind]
willSave: Optional[bool]
willSaveWaitUntil: Optional[bool]
save: Union[bool, SaveOptions, None]
[docs]
class NotebookDocument(TypedDict, total=False):
uri: URI
notebookType: str
version: int
metadata: Optional[LSPObject]
cells: List['NotebookCell']
[docs]
class NotebookCell(TypedDict, total=False):
kind: 'NotebookCellKind'
document: DocumentUri
metadata: Optional[LSPObject]
executionSummary: Optional['ExecutionSummary']
[docs]
class NotebookCellKind(IntEnum):
Markup = 1
Code = 2
[docs]
class ExecutionSummary(TypedDict, total=False):
executionOrder: int
success: Optional[bool]
[docs]
class NotebookCellTextDocumentFilter(TypedDict, total=False):
notebook: Union[str, 'NotebookDocumentFilter']
language: Optional[str]
[docs]
class NotebookDocumentFilter_0(TypedDict, total=False):
notebookType: str
scheme: Optional[str]
pattern: Optional[str]
[docs]
class NotebookDocumentFilter_1(TypedDict, total=False):
notebookType: Optional[str]
scheme: str
pattern: Optional[str]
[docs]
class NotebookDocumentFilter_2(TypedDict, total=False):
notebookType: Optional[str]
scheme: Optional[str]
pattern: str
NotebookDocumentFilter = Union[NotebookDocumentFilter_0, NotebookDocumentFilter_1, NotebookDocumentFilter_2]
[docs]
class NotebookDocumentSyncClientCapabilities(TypedDict, total=False):
dynamicRegistration: Optional[bool]
executionSummarySupport: Optional[bool]
[docs]
class NotebookDocumentSyncOptions(TypedDict, total=False):
[docs]
class NotebookSelector_0(TypedDict, total=False):
[docs]
class Cells_0(TypedDict, total=True):
language: str
notebook: Union[str, NotebookDocumentFilter]
cells: Optional[List[Cells_0]]
[docs]
class NotebookSelector_1(TypedDict, total=False):
[docs]
class Cells_0(TypedDict, total=True):
language: str
notebook: Union[str, NotebookDocumentFilter, None]
cells: List[Cells_0]
notebookSelector: List[Union[NotebookSelector_0, NotebookSelector_1]]
save: Optional[bool]
[docs]
class NotebookDocumentSyncRegistrationOptions(NotebookDocumentSyncOptions, StaticRegistrationOptions, TypedDict, total=True):
pass
[docs]
class DidOpenNotebookDocumentParams(TypedDict, total=True):
notebookDocument: NotebookDocument
cellTextDocuments: List[TextDocumentItem]
[docs]
class DidChangeNotebookDocumentParams(TypedDict, total=True):
notebookDocument: 'VersionedNotebookDocumentIdentifier'
change: 'NotebookDocumentChangeEvent'
[docs]
class VersionedNotebookDocumentIdentifier(TypedDict, total=True):
version: int
uri: URI
[docs]
class NotebookDocumentChangeEvent(TypedDict, total=False):
[docs]
class Cells_0(TypedDict, total=False):
[docs]
class Structure_0(TypedDict, total=False):
array: 'NotebookCellArrayChange'
didOpen: Optional[List[TextDocumentItem]]
didClose: Optional[List[TextDocumentIdentifier]]
[docs]
class TextContent_0(TypedDict, total=True):
document: VersionedTextDocumentIdentifier
changes: List[TextDocumentContentChangeEvent]
structure: Optional[Structure_0]
data: Optional[List[NotebookCell]]
textContent: Optional[List[TextContent_0]]
metadata: Optional[LSPObject]
cells: Optional[Cells_0]
[docs]
class NotebookCellArrayChange(TypedDict, total=False):
start: int
deleteCount: int
cells: Optional[List[NotebookCell]]
[docs]
class DidSaveNotebookDocumentParams(TypedDict, total=True):
notebookDocument: 'NotebookDocumentIdentifier'
[docs]
class DidCloseNotebookDocumentParams(TypedDict, total=True):
notebookDocument: 'NotebookDocumentIdentifier'
cellTextDocuments: List[TextDocumentIdentifier]
[docs]
class NotebookDocumentIdentifier(TypedDict, total=True):
uri: URI
[docs]
class DeclarationClientCapabilities(TypedDict, total=False):
dynamicRegistration: Optional[bool]
linkSupport: Optional[bool]
[docs]
class DeclarationOptions(WorkDoneProgressOptions, TypedDict, total=True):
pass
[docs]
class DeclarationRegistrationOptions(DeclarationOptions, TextDocumentRegistrationOptions, StaticRegistrationOptions, TypedDict, total=True):
pass
[docs]
class DeclarationParams(TextDocumentPositionParams, WorkDoneProgressParams, PartialResultParams, TypedDict, total=True):
pass
[docs]
class DefinitionClientCapabilities(TypedDict, total=False):
dynamicRegistration: Optional[bool]
linkSupport: Optional[bool]
[docs]
class DefinitionOptions(WorkDoneProgressOptions, TypedDict, total=True):
pass
[docs]
class DefinitionRegistrationOptions(TextDocumentRegistrationOptions, DefinitionOptions, TypedDict, total=True):
pass
[docs]
class DefinitionParams(TextDocumentPositionParams, WorkDoneProgressParams, PartialResultParams, TypedDict, total=True):
pass
[docs]
class TypeDefinitionClientCapabilities(TypedDict, total=False):
dynamicRegistration: Optional[bool]
linkSupport: Optional[bool]
[docs]
class TypeDefinitionOptions(WorkDoneProgressOptions, TypedDict, total=True):
pass
[docs]
class TypeDefinitionRegistrationOptions(TextDocumentRegistrationOptions, TypeDefinitionOptions, StaticRegistrationOptions, TypedDict, total=True):
pass
[docs]
class TypeDefinitionParams(TextDocumentPositionParams, WorkDoneProgressParams, PartialResultParams, TypedDict, total=True):
pass
[docs]
class ImplementationClientCapabilities(TypedDict, total=False):
dynamicRegistration: Optional[bool]
linkSupport: Optional[bool]
[docs]
class ImplementationOptions(WorkDoneProgressOptions, TypedDict, total=True):
pass
[docs]
class ImplementationRegistrationOptions(TextDocumentRegistrationOptions, ImplementationOptions, StaticRegistrationOptions, TypedDict, total=True):
pass
[docs]
class ImplementationParams(TextDocumentPositionParams, WorkDoneProgressParams, PartialResultParams, TypedDict, total=True):
pass
[docs]
class ReferenceClientCapabilities(TypedDict, total=False):
dynamicRegistration: Optional[bool]
[docs]
class ReferenceOptions(WorkDoneProgressOptions, TypedDict, total=True):
pass
[docs]
class ReferenceRegistrationOptions(TextDocumentRegistrationOptions, ReferenceOptions, TypedDict, total=True):
pass
[docs]
class ReferenceParams(TextDocumentPositionParams, WorkDoneProgressParams, PartialResultParams, TypedDict, total=True):
context: 'ReferenceContext'
[docs]
class ReferenceContext(TypedDict, total=True):
includeDeclaration: bool
[docs]
class CallHierarchyClientCapabilities(TypedDict, total=False):
dynamicRegistration: Optional[bool]
[docs]
class CallHierarchyOptions(WorkDoneProgressOptions, TypedDict, total=True):
pass
[docs]
class CallHierarchyRegistrationOptions(TextDocumentRegistrationOptions, CallHierarchyOptions, StaticRegistrationOptions, TypedDict, total=True):
pass
[docs]
class CallHierarchyPrepareParams(TextDocumentPositionParams, WorkDoneProgressParams, TypedDict, total=True):
pass
[docs]
class CallHierarchyItem(TypedDict, total=False):
name: str
kind: 'SymbolKind'
tags: Optional[List['SymbolTag']]
detail: Optional[str]
uri: DocumentUri
range: Range
selectionRange: Range
data: Optional[LSPAny]
[docs]
class CallHierarchyIncomingCallsParams(WorkDoneProgressParams, PartialResultParams, TypedDict, total=True):
item: CallHierarchyItem
[docs]
class CallHierarchyIncomingCall(TypedDict, total=True):
from_: CallHierarchyItem
fromRanges: List[Range]
[docs]
class CallHierarchyOutgoingCallsParams(WorkDoneProgressParams, PartialResultParams, TypedDict, total=True):
item: CallHierarchyItem
[docs]
class CallHierarchyOutgoingCall(TypedDict, total=True):
to: CallHierarchyItem
fromRanges: List[Range]
[docs]
class TypeHierarchyClientCapabilities_0(TypedDict, total=False):
dynamicRegistration: Optional[bool]
TypeHierarchyClientCapabilities = TypeHierarchyClientCapabilities_0
[docs]
class TypeHierarchyOptions(WorkDoneProgressOptions, TypedDict, total=True):
pass
[docs]
class TypeHierarchyRegistrationOptions(TextDocumentRegistrationOptions, TypeHierarchyOptions, StaticRegistrationOptions, TypedDict, total=True):
pass
[docs]
class TypeHierarchyPrepareParams(TextDocumentPositionParams, WorkDoneProgressParams, TypedDict, total=True):
pass
[docs]
class TypeHierarchyItem(TypedDict, total=False):
name: str
kind: 'SymbolKind'
tags: Optional[List['SymbolTag']]
detail: Optional[str]
uri: DocumentUri
range: Range
selectionRange: Range
data: Optional[LSPAny]
[docs]
class TypeHierarchySupertypesParams(WorkDoneProgressParams, PartialResultParams, TypedDict, total=True):
item: TypeHierarchyItem
[docs]
class TypeHierarchySubtypesParams(WorkDoneProgressParams, PartialResultParams, TypedDict, total=True):
item: TypeHierarchyItem
[docs]
class DocumentHighlightClientCapabilities(TypedDict, total=False):
dynamicRegistration: Optional[bool]
[docs]
class DocumentHighlightOptions(WorkDoneProgressOptions, TypedDict, total=True):
pass
[docs]
class DocumentHighlightRegistrationOptions(TextDocumentRegistrationOptions, DocumentHighlightOptions, TypedDict, total=True):
pass
[docs]
class DocumentHighlightParams(TextDocumentPositionParams, WorkDoneProgressParams, PartialResultParams, TypedDict, total=True):
pass
[docs]
class DocumentHighlight(TypedDict, total=False):
range: Range
kind: Optional['DocumentHighlightKind']
[docs]
class DocumentHighlightKind(IntEnum):
Text = 1
Read = 2
Write = 3
# commented out, because there is already an enumeration with the same name
# DocumentHighlightKind = int
[docs]
class DocumentLinkClientCapabilities(TypedDict, total=False):
dynamicRegistration: Optional[bool]
tooltipSupport: Optional[bool]
[docs]
class DocumentLinkOptions(WorkDoneProgressOptions, TypedDict, total=False):
resolveProvider: Optional[bool]
[docs]
class DocumentLinkRegistrationOptions(TextDocumentRegistrationOptions, DocumentLinkOptions, TypedDict, total=True):
pass
[docs]
class DocumentLinkParams(WorkDoneProgressParams, PartialResultParams, TypedDict, total=True):
textDocument: TextDocumentIdentifier
[docs]
class DocumentLink(TypedDict, total=False):
range: Range
target: Optional[URI]
tooltip: Optional[str]
data: Optional[LSPAny]
[docs]
class HoverClientCapabilities(TypedDict, total=False):
dynamicRegistration: Optional[bool]
contentFormat: Optional[List[MarkupKind]]
[docs]
class HoverOptions(WorkDoneProgressOptions, TypedDict, total=True):
pass
[docs]
class HoverRegistrationOptions(TextDocumentRegistrationOptions, HoverOptions, TypedDict, total=True):
pass
[docs]
class HoverParams(TextDocumentPositionParams, WorkDoneProgressParams, TypedDict, total=True):
pass
[docs]
class Hover(TypedDict, total=False):
contents: Union['MarkedString', List['MarkedString'], MarkupContent]
range: Optional[Range]
[docs]
class MarkedString_1(TypedDict, total=True):
language: str
value: str
MarkedString = Union[str, MarkedString_1]
[docs]
class CodeLensClientCapabilities(TypedDict, total=False):
dynamicRegistration: Optional[bool]
resolveSupport: Optional['ClientCodeLensResolveOptions']
[docs]
class ClientCodeLensResolveOptions_0(TypedDict, total=True):
properties: List[str]
ClientCodeLensResolveOptions = ClientCodeLensResolveOptions_0
[docs]
class CodeLensOptions(WorkDoneProgressOptions, TypedDict, total=False):
resolveProvider: Optional[bool]
[docs]
class CodeLensRegistrationOptions(TextDocumentRegistrationOptions, CodeLensOptions, TypedDict, total=True):
pass
[docs]
class CodeLensParams(WorkDoneProgressParams, PartialResultParams, TypedDict, total=True):
textDocument: TextDocumentIdentifier
[docs]
class CodeLens(TypedDict, total=False):
range: Range
command: Optional[Command]
data: Optional[LSPAny]
[docs]
class CodeLensWorkspaceClientCapabilities(TypedDict, total=False):
refreshSupport: Optional[bool]
[docs]
class FoldingRangeClientCapabilities(TypedDict, total=False):
[docs]
class FoldingRangeKind_0(TypedDict, total=False):
valueSet: Optional[List['FoldingRangeKind']]
[docs]
class FoldingRange_0(TypedDict, total=False):
collapsedText: Optional[bool]
dynamicRegistration: Optional[bool]
rangeLimit: Optional[int]
lineFoldingOnly: Optional[bool]
foldingRangeKind: Optional[FoldingRangeKind_0]
foldingRange: Optional[FoldingRange_0]
[docs]
class FoldingRangeOptions(WorkDoneProgressOptions, TypedDict, total=True):
pass
[docs]
class FoldingRangeRegistrationOptions(TextDocumentRegistrationOptions, FoldingRangeOptions, StaticRegistrationOptions, TypedDict, total=True):
pass
[docs]
class FoldingRangeParams(WorkDoneProgressParams, PartialResultParams, TypedDict, total=True):
textDocument: TextDocumentIdentifier
[docs]
class FoldingRangeKind(Enum):
Comment = 'comment'
Imports = 'imports'
Region = 'region'
# commented out, because there is already an enumeration with the same name
# FoldingRangeKind = str
[docs]
class FoldingRange(TypedDict, total=False):
startLine: int
startCharacter: Optional[int]
endLine: int
endCharacter: Optional[int]
kind: Optional[FoldingRangeKind]
collapsedText: Optional[str]
[docs]
class FoldingRangeWorkspaceClientCapabilities(TypedDict, total=False):
refreshSupport: Optional[bool]
[docs]
class SelectionRangeClientCapabilities(TypedDict, total=False):
dynamicRegistration: Optional[bool]
[docs]
class SelectionRangeOptions(WorkDoneProgressOptions, TypedDict, total=True):
pass
[docs]
class SelectionRangeRegistrationOptions(SelectionRangeOptions, TextDocumentRegistrationOptions, StaticRegistrationOptions, TypedDict, total=True):
pass
[docs]
class SelectionRangeParams(WorkDoneProgressParams, PartialResultParams, TypedDict, total=True):
textDocument: TextDocumentIdentifier
positions: List[Position]
[docs]
class SelectionRange(TypedDict, total=False):
range: Range
parent: Optional['SelectionRange']
[docs]
class DocumentSymbolClientCapabilities(TypedDict, total=False):
[docs]
class SymbolKind_0(TypedDict, total=False):
valueSet: Optional[List['SymbolKind']]
dynamicRegistration: Optional[bool]
symbolKind: Optional[SymbolKind_0]
hierarchicalDocumentSymbolSupport: Optional[bool]
tagSupport: Optional[TagSupport_0]
labelSupport: Optional[bool]
[docs]
class DocumentSymbolOptions(WorkDoneProgressOptions, TypedDict, total=False):
label: Optional[str]
[docs]
class DocumentSymbolRegistrationOptions(TextDocumentRegistrationOptions, DocumentSymbolOptions, TypedDict, total=True):
pass
[docs]
class DocumentSymbolParams(WorkDoneProgressParams, PartialResultParams, TypedDict, total=True):
textDocument: TextDocumentIdentifier
[docs]
class SymbolKind(IntEnum):
File = 1
Module = 2
Namespace = 3
Package = 4
Class = 5
Method = 6
Property = 7
Field = 8
Constructor = 9
Enum = 10
Interface = 11
Function = 12
Variable = 13
Constant = 14
String = 15
Number = 16
Boolean = 17
Array = 18
Object = 19
Key = 20
Null = 21
EnumMember = 22
Struct = 23
Event = 24
Operator = 25
TypeParameter = 26
# commented out, because there is already an enumeration with the same name
# SymbolKind = int
[docs]
class SymbolTag(IntEnum):
Deprecated = 1
# commented out, because there is already an enumeration with the same name
# SymbolTag = int
[docs]
class DocumentSymbol(TypedDict, total=False):
name: str
detail: Optional[str]
kind: SymbolKind
tags: Optional[List[SymbolTag]]
deprecated: Optional[bool]
range: Range
selectionRange: Range
children: Optional[List['DocumentSymbol']]
[docs]
class SemanticTokenTypes(Enum):
namespace = 'namespace'
type = 'type'
class_ = 'class'
enum = 'enum'
interface = 'interface'
struct = 'struct'
typeParameter = 'typeParameter'
parameter = 'parameter'
variable = 'variable'
property = 'property'
enumMember = 'enumMember'
event = 'event'
function = 'function'
method = 'method'
macro = 'macro'
keyword = 'keyword'
modifier = 'modifier'
comment = 'comment'
string = 'string'
number = 'number'
regexp = 'regexp'
operator = 'operator'
decorator = 'decorator'
[docs]
class SemanticTokenModifiers(Enum):
declaration = 'declaration'
definition = 'definition'
readonly = 'readonly'
static = 'static'
deprecated = 'deprecated'
abstract = 'abstract'
async_ = 'async'
modification = 'modification'
documentation = 'documentation'
defaultLibrary = 'defaultLibrary'
# commented out, because there is already an enumeration with the same name
# TokenFormat = str
[docs]
class SemanticTokensLegend(TypedDict, total=True):
tokenTypes: List[str]
tokenModifiers: List[str]
[docs]
class SemanticTokensClientCapabilities(TypedDict, total=False):
[docs]
class Requests_0(TypedDict, total=False):
[docs]
class Range_1(TypedDict, total=True):
pass
[docs]
class Full_1(TypedDict, total=False):
delta: Optional[bool]
range: Union[bool, Range_1, None]
full: Union[bool, Full_1, None]
dynamicRegistration: Optional[bool]
requests: Requests_0
tokenTypes: List[str]
tokenModifiers: List[str]
formats: List[TokenFormat]
overlappingTokenSupport: Optional[bool]
multilineTokenSupport: Optional[bool]
serverCancelSupport: Optional[bool]
augmentsSyntaxTokens: Optional[bool]
[docs]
class SemanticTokensOptions(WorkDoneProgressOptions, TypedDict, total=False):
[docs]
class Range_1(TypedDict, total=True):
pass
[docs]
class Full_1(TypedDict, total=False):
delta: Optional[bool]
legend: SemanticTokensLegend
range: Union[bool, Range_1, None]
full: Union[bool, Full_1, None]
[docs]
class SemanticTokensRegistrationOptions(TextDocumentRegistrationOptions, SemanticTokensOptions, StaticRegistrationOptions, TypedDict, total=True):
pass
[docs]
class SemanticTokensParams(WorkDoneProgressParams, PartialResultParams, TypedDict, total=True):
textDocument: TextDocumentIdentifier
[docs]
class SemanticTokens(TypedDict, total=False):
resultId: Optional[str]
data: List[int]
[docs]
class SemanticTokensPartialResult(TypedDict, total=True):
data: List[int]
[docs]
class SemanticTokensDeltaParams(WorkDoneProgressParams, PartialResultParams, TypedDict, total=True):
textDocument: TextDocumentIdentifier
previousResultId: str
[docs]
class SemanticTokensDelta(TypedDict, total=False):
resultId: Optional[str]
edits: List['SemanticTokensEdit']
[docs]
class SemanticTokensEdit(TypedDict, total=False):
start: int
deleteCount: int
data: Optional[List[int]]
[docs]
class SemanticTokensDeltaPartialResult(TypedDict, total=True):
edits: List[SemanticTokensEdit]
[docs]
class SemanticTokensRangeParams(WorkDoneProgressParams, PartialResultParams, TypedDict, total=True):
textDocument: TextDocumentIdentifier
range: Range
[docs]
class SemanticTokensWorkspaceClientCapabilities(TypedDict, total=False):
refreshSupport: Optional[bool]
[docs]
class InlayHintClientCapabilities(TypedDict, total=False):
[docs]
class ResolveSupport_0(TypedDict, total=True):
properties: List[str]
dynamicRegistration: Optional[bool]
resolveSupport: Optional[ResolveSupport_0]
[docs]
class InlayHintOptions(WorkDoneProgressOptions, TypedDict, total=False):
resolveProvider: Optional[bool]
[docs]
class InlayHintRegistrationOptions(InlayHintOptions, TextDocumentRegistrationOptions, StaticRegistrationOptions, TypedDict, total=True):
pass
[docs]
class InlayHintParams(WorkDoneProgressParams, TypedDict, total=True):
textDocument: TextDocumentIdentifier
range: Range
[docs]
class InlayHint(TypedDict, total=False):
position: Position
label: Union[str, List['InlayHintLabelPart']]
kind: Optional['InlayHintKind']
textEdits: Optional[List[TextEdit]]
tooltip: Union[str, MarkupContent, None]
paddingLeft: Optional[bool]
paddingRight: Optional[bool]
data: Optional[LSPAny]
[docs]
class InlayHintLabelPart(TypedDict, total=False):
value: str
tooltip: Union[str, MarkupContent, None]
location: Optional[Location]
command: Optional[Command]
[docs]
class InlayHintKind(IntEnum):
Type = 1
Parameter = 2
# commented out, because there is already an enumeration with the same name
# InlayHintKind = int
[docs]
class InlayHintWorkspaceClientCapabilities(TypedDict, total=False):
refreshSupport: Optional[bool]
[docs]
class InlineValueClientCapabilities(TypedDict, total=False):
dynamicRegistration: Optional[bool]
[docs]
class InlineValueOptions(WorkDoneProgressOptions, TypedDict, total=True):
pass
[docs]
class InlineValueRegistrationOptions(InlineValueOptions, TextDocumentRegistrationOptions, StaticRegistrationOptions, TypedDict, total=True):
pass
[docs]
class InlineValueParams(WorkDoneProgressParams, TypedDict, total=True):
textDocument: TextDocumentIdentifier
range: Range
context: 'InlineValueContext'
[docs]
class InlineValueContext(TypedDict, total=True):
frameId: int
stoppedLocation: Range
[docs]
class InlineValueText(TypedDict, total=True):
range: Range
text: str
[docs]
class InlineValueVariableLookup(TypedDict, total=False):
range: Range
iableName: Optional[str]
caseSensitiveLookup: bool
[docs]
class InlineValueEvaluatableExpression(TypedDict, total=False):
range: Range
expression: Optional[str]
InlineValue = Union[InlineValueText, InlineValueVariableLookup, InlineValueEvaluatableExpression]
[docs]
class InlineValueWorkspaceClientCapabilities(TypedDict, total=False):
refreshSupport: Optional[bool]
[docs]
class MonikerClientCapabilities(TypedDict, total=False):
dynamicRegistration: Optional[bool]
[docs]
class MonikerOptions(WorkDoneProgressOptions, TypedDict, total=True):
pass
[docs]
class MonikerRegistrationOptions(TextDocumentRegistrationOptions, MonikerOptions, TypedDict, total=True):
pass
[docs]
class MonikerParams(TextDocumentPositionParams, WorkDoneProgressParams, PartialResultParams, TypedDict, total=True):
pass
[docs]
class UniquenessLevel(Enum):
document = 'document'
project = 'project'
group = 'group'
scheme = 'scheme'
global_ = 'global'
[docs]
class MonikerKind(Enum):
import_ = 'import'
export = 'export'
local = 'local'
[docs]
class Moniker(TypedDict, total=False):
scheme: str
identifier: str
unique: UniquenessLevel
kind: Optional[MonikerKind]
[docs]
class CompletionClientCapabilities(TypedDict, total=False):
[docs]
class CompletionItem_0(TypedDict, total=False):
[docs]
class ResolveSupport_0(TypedDict, total=True):
properties: List[str]
[docs]
class InsertTextModeSupport_0(TypedDict, total=True):
valueSet: List['InsertTextMode']
snippetSupport: Optional[bool]
commitCharactersSupport: Optional[bool]
documentationFormat: Optional[List[MarkupKind]]
deprecatedSupport: Optional[bool]
preselectSupport: Optional[bool]
tagSupport: Optional[TagSupport_0]
insertReplaceSupport: Optional[bool]
resolveSupport: Optional[ResolveSupport_0]
insertTextModeSupport: Optional[InsertTextModeSupport_0]
labelDetailsSupport: Optional[bool]
[docs]
class CompletionItemKind_0(TypedDict, total=False):
valueSet: Optional[List['CompletionItemKind']]
[docs]
class CompletionList_0(TypedDict, total=False):
itemDefaults: Optional[List[str]]
dynamicRegistration: Optional[bool]
completionItem: Optional[CompletionItem_0]
completionItemKind: Optional[CompletionItemKind_0]
contextSupport: Optional[bool]
insertTextMode: Optional['InsertTextMode']
completionList: Optional[CompletionList_0]
[docs]
class CompletionOptions(WorkDoneProgressOptions, TypedDict, total=False):
[docs]
class CompletionItem_0(TypedDict, total=False):
labelDetailsSupport: Optional[bool]
triggerCharacters: Optional[List[str]]
allCommitCharacters: Optional[List[str]]
resolveProvider: Optional[bool]
completionItem: Optional[CompletionItem_0]
[docs]
class CompletionRegistrationOptions(TextDocumentRegistrationOptions, CompletionOptions, TypedDict, total=True):
pass
[docs]
class CompletionParams(TextDocumentPositionParams, WorkDoneProgressParams, PartialResultParams, TypedDict, total=False):
context: Optional['CompletionContext']
[docs]
class CompletionTriggerKind(IntEnum):
Invoked = 1
TriggerCharacter = 2
TriggerForIncompleteCompletions = 3
# commented out, because there is already an enumeration with the same name
# CompletionTriggerKind = int
[docs]
class CompletionContext(TypedDict, total=False):
triggerKind: CompletionTriggerKind
triggerCharacter: Optional[str]
[docs]
class CompletionList(TypedDict, total=False):
[docs]
class ItemDefaults_0(TypedDict, total=False):
[docs]
class EditRange_1(TypedDict, total=True):
insert: Range
replace: Range
commitCharacters: Optional[List[str]]
editRange: Union[Range, EditRange_1, None]
insertTextFormat: Optional['InsertTextFormat']
insertTextMode: Optional['InsertTextMode']
data: Optional[LSPAny]
isIncomplete: bool
itemDefaults: Optional[ItemDefaults_0]
items: List['CompletionItem']
[docs]
class InsertTextFormat(IntEnum):
PlainText = 1
Snippet = 2
# commented out, because there is already an enumeration with the same name
# InsertTextFormat = int
[docs]
class CompletionItemTag(IntEnum):
Deprecated = 1
# commented out, because there is already an enumeration with the same name
# CompletionItemTag = int
[docs]
class InsertReplaceEdit(TypedDict, total=True):
newText: str
insert: Range
replace: Range
[docs]
class InsertTextMode(IntEnum):
asIs = 1
adjustIndentation = 2
# commented out, because there is already an enumeration with the same name
# InsertTextMode = int
[docs]
class CompletionItemLabelDetails(TypedDict, total=False):
detail: Optional[str]
description: Optional[str]
[docs]
class CompletionItem(TypedDict, total=False):
label: str
labelDetails: Optional[CompletionItemLabelDetails]
kind: Optional['CompletionItemKind']
tags: Optional[List[CompletionItemTag]]
detail: Optional[str]
documentation: Union[str, MarkupContent, None]
deprecated: Optional[bool]
preselect: Optional[bool]
sortText: Optional[str]
filterText: Optional[str]
insertText: Optional[str]
insertTextFormat: Optional[InsertTextFormat]
insertTextMode: Optional[InsertTextMode]
textEdit: Union[TextEdit, InsertReplaceEdit, None]
textEditText: Optional[str]
additionalTextEdits: Optional[List[TextEdit]]
commitCharacters: Optional[List[str]]
command: Optional[Command]
data: Optional[LSPAny]
[docs]
class CompletionItemKind(IntEnum):
Text = 1
Method = 2
Function = 3
Constructor = 4
Field = 5
Variable = 6
Class = 7
Interface = 8
Module = 9
Property = 10
Unit = 11
Value = 12
Enum = 13
Keyword = 14
Snippet = 15
Color = 16
File = 17
Reference = 18
Folder = 19
EnumMember = 20
Constant = 21
Struct = 22
Event = 23
Operator = 24
TypeParameter = 25
# commented out, because there is already an enumeration with the same name
# CompletionItemKind = int
[docs]
class PublishDiagnosticsClientCapabilities(TypedDict, total=False):
relatedInformation: Optional[bool]
tagSupport: Optional[TagSupport_0]
versionSupport: Optional[bool]
codeDescriptionSupport: Optional[bool]
dataSupport: Optional[bool]
[docs]
class PublishDiagnosticsParams(TypedDict, total=False):
uri: DocumentUri
version: Optional[int]
diagnostics: List[Diagnostic]
[docs]
class DiagnosticClientCapabilities(TypedDict, total=False):
dynamicRegistration: Optional[bool]
relatedDocumentSupport: Optional[bool]
markupMessageSupport: Optional[bool]
[docs]
class DiagnosticOptions(WorkDoneProgressOptions, TypedDict, total=False):
identifier: Optional[str]
interFileDependencies: bool
workspaceDiagnostics: bool
[docs]
class DiagnosticRegistrationOptions(TextDocumentRegistrationOptions, DiagnosticOptions, StaticRegistrationOptions, TypedDict, total=True):
pass
[docs]
class DocumentDiagnosticParams(WorkDoneProgressParams, PartialResultParams, TypedDict, total=False):
textDocument: TextDocumentIdentifier
identifier: Optional[str]
previousResultId: Optional[str]
DocumentDiagnosticReport = Union['RelatedFullDocumentDiagnosticReport', 'RelatedUnchangedDocumentDiagnosticReport']
[docs]
class DocumentDiagnosticReportKind(Enum):
Full = 'full'
Unchanged = 'unchanged'
# commented out, because there is already an enumeration with the same name
# DocumentDiagnosticReportKind = str
[docs]
class FullDocumentDiagnosticReport(TypedDict, total=False):
kind: 'DocumentDiagnosticReportKind.Full'
resultId: Optional[str]
items: List[Diagnostic]
[docs]
class UnchangedDocumentDiagnosticReport(TypedDict, total=True):
kind: 'DocumentDiagnosticReportKind.Unchanged'
resultId: str
[docs]
class DocumentDiagnosticReportPartialResult(TypedDict, total=True):
relatedDocuments: Dict[str, Union[FullDocumentDiagnosticReport, UnchangedDocumentDiagnosticReport]]
[docs]
class DiagnosticServerCancellationData(TypedDict, total=True):
retriggerRequest: bool
[docs]
class WorkspaceDiagnosticParams(WorkDoneProgressParams, PartialResultParams, TypedDict, total=False):
identifier: Optional[str]
previousResultIds: List['PreviousResultId']
[docs]
class PreviousResultId(TypedDict, total=True):
uri: DocumentUri
value: str
[docs]
class WorkspaceDiagnosticReport(TypedDict, total=True):
items: List['WorkspaceDocumentDiagnosticReport']
[docs]
class WorkspaceFullDocumentDiagnosticReport(FullDocumentDiagnosticReport, TypedDict, total=True):
uri: DocumentUri
version: Union[int, None]
[docs]
class WorkspaceUnchangedDocumentDiagnosticReport(UnchangedDocumentDiagnosticReport, TypedDict, total=True):
uri: DocumentUri
version: Union[int, None]
WorkspaceDocumentDiagnosticReport = Union[WorkspaceFullDocumentDiagnosticReport, WorkspaceUnchangedDocumentDiagnosticReport]
[docs]
class WorkspaceDiagnosticReportPartialResult(TypedDict, total=True):
items: List[WorkspaceDocumentDiagnosticReport]
[docs]
class DiagnosticWorkspaceClientCapabilities(TypedDict, total=False):
refreshSupport: Optional[bool]
[docs]
class SignatureHelpClientCapabilities(TypedDict, total=False):
dynamicRegistration: Optional[bool]
signatureInformation: Optional[SignatureInformation_0]
contextSupport: Optional[bool]
[docs]
class SignatureHelpOptions(WorkDoneProgressOptions, TypedDict, total=False):
triggerCharacters: Optional[List[str]]
retriggerCharacters: Optional[List[str]]
[docs]
class SignatureHelpRegistrationOptions(TextDocumentRegistrationOptions, SignatureHelpOptions, TypedDict, total=True):
pass
[docs]
class SignatureHelpParams(TextDocumentPositionParams, WorkDoneProgressParams, TypedDict, total=False):
context: Optional['SignatureHelpContext']
[docs]
class SignatureHelpTriggerKind(IntEnum):
Invoked = 1
TriggerCharacter = 2
ContentChange = 3
# commented out, because there is already an enumeration with the same name
# SignatureHelpTriggerKind = int
[docs]
class SignatureHelpContext(TypedDict, total=False):
triggerKind: SignatureHelpTriggerKind
triggerCharacter: Optional[str]
isRetrigger: bool
activeSignatureHelp: Optional['SignatureHelp']
[docs]
class SignatureHelp(TypedDict, total=False):
signatures: List['SignatureInformation']
activeSignature: Optional[int]
activeParameter: Union[int, None]
[docs]
class CodeActionClientCapabilities(TypedDict, total=False):
[docs]
class CodeActionLiteralSupport_0(TypedDict, total=True):
[docs]
class CodeActionKind_0(TypedDict, total=True):
valueSet: List['CodeActionKind']
codeActionKind: CodeActionKind_0
[docs]
class ResolveSupport_0(TypedDict, total=True):
properties: List[str]
dynamicRegistration: Optional[bool]
codeActionLiteralSupport: Optional[CodeActionLiteralSupport_0]
isPreferredSupport: Optional[bool]
disabledSupport: Optional[bool]
dataSupport: Optional[bool]
resolveSupport: Optional[ResolveSupport_0]
honorsChangeAnnotations: Optional[bool]
documentationSupport: Optional[bool]
[docs]
class CodeActionKindDocumentation(TypedDict, total=True):
kind: 'CodeActionKind'
command: Command
[docs]
class CodeActionOptions(WorkDoneProgressOptions, TypedDict, total=False):
codeActionKinds: Optional[List['CodeActionKind']]
documentation: Optional[List[CodeActionKindDocumentation]]
resolveProvider: Optional[bool]
[docs]
class CodeActionRegistrationOptions(TextDocumentRegistrationOptions, CodeActionOptions, TypedDict, total=True):
pass
[docs]
class CodeActionParams(WorkDoneProgressParams, PartialResultParams, TypedDict, total=True):
textDocument: TextDocumentIdentifier
range: Range
context: 'CodeActionContext'
CodeActionKind = str
[docs]
class CodeActionKind(Enum):
Empty = ''
QuickFix = 'quickfix'
Refactor = 'refactor'
RefactorExtract = 'refactor.extract'
RefactorInline = 'refactor.inline'
RefactorMove = 'refactor.move'
RefactorRewrite = 'refactor.rewrite'
Source = 'source'
SourceOrganizeImports = 'source.organizeImports'
SourceFixAll = 'source.fixAll'
Notebook = 'notebook'
[docs]
class CodeActionContext(TypedDict, total=False):
diagnostics: List[Diagnostic]
only: Optional[List[CodeActionKind]]
triggerKind: Optional['CodeActionTriggerKind']
[docs]
class CodeActionTriggerKind(IntEnum):
Invoked = 1
Automatic = 2
# commented out, because there is already an enumeration with the same name
# CodeActionTriggerKind = int
[docs]
class CodeAction(TypedDict, total=False):
[docs]
class Disabled_0(TypedDict, total=True):
reason: str
title: str
kind: Optional[CodeActionKind]
diagnostics: Optional[List[Diagnostic]]
isPreferred: Optional[bool]
disabled: Optional[Disabled_0]
edit: Optional[WorkspaceEdit]
command: Optional[Command]
data: Optional[LSPAny]
[docs]
class DocumentColorClientCapabilities(TypedDict, total=False):
dynamicRegistration: Optional[bool]
[docs]
class DocumentColorOptions(WorkDoneProgressOptions, TypedDict, total=True):
pass
[docs]
class DocumentColorRegistrationOptions(TextDocumentRegistrationOptions, StaticRegistrationOptions, DocumentColorOptions, TypedDict, total=True):
pass
[docs]
class DocumentColorParams(WorkDoneProgressParams, PartialResultParams, TypedDict, total=True):
textDocument: TextDocumentIdentifier
[docs]
class Color(TypedDict, total=True):
red: float
green: float
blue: float
alpha: float
[docs]
class ColorPresentationParams(WorkDoneProgressParams, PartialResultParams, TypedDict, total=True):
textDocument: TextDocumentIdentifier
color: Color
range: Range
[docs]
class ColorPresentation(TypedDict, total=False):
label: str
textEdit: Optional[TextEdit]
additionalTextEdits: Optional[List[TextEdit]]
[docs]
class PrepareSupportDefaultBehavior(IntEnum):
Identifier = 1
# commented out, because there is already an enumeration with the same name
# PrepareSupportDefaultBehavior = int
[docs]
class RenameClientCapabilities(TypedDict, total=False):
dynamicRegistration: Optional[bool]
prepareSupport: Optional[bool]
prepareSupportDefaultBehavior: Optional[PrepareSupportDefaultBehavior]
honorsChangeAnnotations: Optional[bool]
[docs]
class RenameOptions(WorkDoneProgressOptions, TypedDict, total=False):
prepareProvider: Optional[bool]
[docs]
class RenameRegistrationOptions(TextDocumentRegistrationOptions, RenameOptions, TypedDict, total=True):
pass
[docs]
class RenameParams(TextDocumentPositionParams, WorkDoneProgressParams, TypedDict, total=True):
newName: str
[docs]
class PrepareRenameParams(TextDocumentPositionParams, WorkDoneProgressParams, TypedDict, total=True):
pass
[docs]
class LinkedEditingRangeClientCapabilities(TypedDict, total=False):
dynamicRegistration: Optional[bool]
[docs]
class LinkedEditingRangeOptions(WorkDoneProgressOptions, TypedDict, total=True):
pass
[docs]
class LinkedEditingRangeRegistrationOptions(TextDocumentRegistrationOptions, LinkedEditingRangeOptions, StaticRegistrationOptions, TypedDict, total=True):
pass
[docs]
class LinkedEditingRangeParams(TextDocumentPositionParams, WorkDoneProgressParams, TypedDict, total=True):
pass
[docs]
class LinkedEditingRanges(TypedDict, total=False):
ranges: List[Range]
wordPattern: Optional[str]
[docs]
class InlineCompletionClientCapabilities(TypedDict, total=False):
dynamicRegistration: Optional[bool]
[docs]
class InlineCompletionOptions(WorkDoneProgressOptions, TypedDict, total=True):
pass
[docs]
class InlineCompletionRegistrationOptions(InlineCompletionOptions, TextDocumentRegistrationOptions, StaticRegistrationOptions, TypedDict, total=True):
pass
[docs]
class InlineCompletionParams(TextDocumentPositionParams, WorkDoneProgressParams, TypedDict, total=True):
context: 'InlineCompletionContext'
[docs]
class InlineCompletionContext(TypedDict, total=False):
triggerKind: 'InlineCompletionTriggerKind'
selectedCompletionInfo: Optional['SelectedCompletionInfo']
[docs]
class InlineCompletionTriggerKind(IntEnum):
Invoked = 1
Automatic = 2
# commented out, because there is already an enumeration with the same name
# InlineCompletionTriggerKind = int
[docs]
class SelectedCompletionInfo(TypedDict, total=True):
range: Range
text: str
[docs]
class InlineCompletionList(TypedDict, total=True):
items: List['InlineCompletionItem']
[docs]
class InlineCompletionItem(TypedDict, total=False):
insertText: Union[str, StringValue]
filterText: Optional[str]
range: Optional[Range]
command: Optional[Command]
[docs]
class WorkspaceSymbolClientCapabilities(TypedDict, total=False):
[docs]
class SymbolKind_0(TypedDict, total=False):
valueSet: Optional[List[SymbolKind]]
[docs]
class ResolveSupport_0(TypedDict, total=True):
properties: List[str]
dynamicRegistration: Optional[bool]
symbolKind: Optional[SymbolKind_0]
tagSupport: Optional[TagSupport_0]
resolveSupport: Optional[ResolveSupport_0]
[docs]
class WorkspaceSymbolOptions(WorkDoneProgressOptions, TypedDict, total=False):
resolveProvider: Optional[bool]
[docs]
class WorkspaceSymbolRegistrationOptions(WorkspaceSymbolOptions, TypedDict, total=True):
pass
[docs]
class WorkspaceSymbolParams(WorkDoneProgressParams, PartialResultParams, TypedDict, total=True):
query: str
[docs]
class WorkspaceSymbol(TypedDict, total=False):
[docs]
class Location_1(TypedDict, total=True):
uri: DocumentUri
name: str
kind: SymbolKind
tags: Optional[List[SymbolTag]]
containerName: Optional[str]
location: Union[Location, Location_1]
data: Optional[LSPAny]
[docs]
class ConfigurationParams(TypedDict, total=True):
items: List['ConfigurationItem']
[docs]
class ConfigurationItem(TypedDict, total=False):
scopeUri: Optional[URI]
section: Optional[str]
[docs]
class DidChangeConfigurationClientCapabilities(TypedDict, total=False):
dynamicRegistration: Optional[bool]
[docs]
class DidChangeConfigurationParams(TypedDict, total=True):
settings: LSPAny
[docs]
class WorkspaceFolder(TypedDict, total=True):
uri: URI
name: str
[docs]
class DidChangeWorkspaceFoldersParams(TypedDict, total=True):
event: 'WorkspaceFoldersChangeEvent'
[docs]
class WorkspaceFoldersChangeEvent(TypedDict, total=True):
added: List[WorkspaceFolder]
removed: List[WorkspaceFolder]
[docs]
class FileOperationRegistrationOptions(TypedDict, total=True):
filters: List['FileOperationFilter']
[docs]
class FileOperationPatternKind(Enum):
file = 'file'
folder = 'folder'
# commented out, because there is already an enumeration with the same name
# FileOperationPatternKind = str
[docs]
class FileOperationPatternOptions(TypedDict, total=False):
ignoreCase: Optional[bool]
[docs]
class FileOperationPattern(TypedDict, total=False):
glob: str
matches: Optional[FileOperationPatternKind]
options: Optional[FileOperationPatternOptions]
[docs]
class FileOperationFilter(TypedDict, total=False):
scheme: Optional[str]
pattern: FileOperationPattern
[docs]
class CreateFilesParams(TypedDict, total=True):
files: List['FileCreate']
[docs]
class FileCreate(TypedDict, total=True):
uri: str
[docs]
class RenameFilesParams(TypedDict, total=True):
files: List['FileRename']
[docs]
class FileRename(TypedDict, total=True):
oldUri: str
newUri: str
[docs]
class DeleteFilesParams(TypedDict, total=True):
files: List['FileDelete']
[docs]
class FileDelete(TypedDict, total=True):
uri: str
[docs]
class DidChangeWatchedFilesClientCapabilities(TypedDict, total=False):
dynamicRegistration: Optional[bool]
relativePatternSupport: Optional[bool]
[docs]
class DidChangeWatchedFilesRegistrationOptions(TypedDict, total=True):
watchers: List['FileSystemWatcher']
Pattern = str
[docs]
class RelativePattern(TypedDict, total=True):
baseUri: Union[WorkspaceFolder, URI]
pattern: Pattern
GlobPattern = Union[Pattern, RelativePattern]
[docs]
class FileSystemWatcher(TypedDict, total=False):
globPattern: GlobPattern
kind: Optional['WatchKind']
[docs]
class WatchKind(IntEnum):
Create = 1
Change = 2
Delete = 4
# commented out, because there is already an enumeration with the same name
# WatchKind = int
[docs]
class DidChangeWatchedFilesParams(TypedDict, total=True):
changes: List['FileEvent']
[docs]
class FileEvent(TypedDict, total=True):
uri: DocumentUri
type: 'FileChangeType'
[docs]
class FileChangeType(IntEnum):
Created = 1
Changed = 2
Deleted = 3
# commented out, because there is already an enumeration with the same name
# FileChangeType = int
[docs]
class ExecuteCommandClientCapabilities(TypedDict, total=False):
dynamicRegistration: Optional[bool]
[docs]
class ExecuteCommandOptions(WorkDoneProgressOptions, TypedDict, total=True):
commands: List[str]
[docs]
class ExecuteCommandRegistrationOptions(ExecuteCommandOptions, TypedDict, total=True):
pass
[docs]
class ExecuteCommandParams(WorkDoneProgressParams, TypedDict, total=False):
command: str
arguments: Optional[List[LSPAny]]
[docs]
class ApplyWorkspaceEditParams(TypedDict, total=False):
label: Optional[str]
edit: WorkspaceEdit
metadata: Optional['WorkspaceEditMetadata']
[docs]
class ApplyWorkspaceEditResult(TypedDict, total=False):
applied: bool
failureReason: Optional[str]
failedChange: Optional[int]
[docs]
class ShowMessageParams(TypedDict, total=True):
type: 'MessageType'
message: str
[docs]
class MessageType(IntEnum):
Error = 1
Warning = 2
Info = 3
Log = 4
Debug = 5
# commented out, because there is already an enumeration with the same name
# MessageType = int
[docs]
class ShowMessageRequestClientCapabilities(TypedDict, total=False):
[docs]
class MessageActionItem_0(TypedDict, total=False):
additionalPropertiesSupport: Optional[bool]
messageActionItem: Optional[MessageActionItem_0]
[docs]
class ShowMessageRequestParams(TypedDict, total=False):
type: MessageType
message: str
actions: Optional[List['MessageActionItem']]
[docs]
class MessageActionItem(TypedDict, total=True):
title: str
[docs]
class ShowDocumentClientCapabilities(TypedDict, total=True):
support: bool
[docs]
class ShowDocumentParams(TypedDict, total=False):
uri: URI
external: Optional[bool]
takeFocus: Optional[bool]
selection: Optional[Range]
[docs]
class ShowDocumentResult(TypedDict, total=True):
success: bool
[docs]
class LogMessageParams(TypedDict, total=True):
type: MessageType
message: str
[docs]
class WorkDoneProgressCreateParams(TypedDict, total=True):
token: ProgressToken
[docs]
class WorkDoneProgressCancelParams(TypedDict, total=True):
token: ProgressToken
##### END OF LSP SPECS
#######################################################################
#
# Language-Server-Protocol methods
#
#######################################################################
class LSPTasks:
def __init__(self, lsp_data: dict):
self.lsp_data = lsp_data
self.lsp_table = gen_lsp_table([], prefix='lsp_')
NO_TASKS = LSPTasks({})
class LSPBase:
def __init__(self, cpu_bound: LSPTasks=NO_TASKS, blocking: LSPTasks=NO_TASKS):
self.lsp_data = {
'processId': 0,
'rootUri': '',
'clientCapabilities': {},
'serverInfo': {"name": self.__class__.__name__, "version": "0.1"},
'serverCapabilities': {
}
}
self.connection = None
self.cpu_bound = cpu_bound
self.blocking = blocking
self.lsp_table = gen_lsp_table(self, prefix='lsp_')
self.lsp_fulltable = self.lsp_table.copy()
assert self.lsp_fulltable.keys().isdisjoint(self.cpu_bound.lsp_table.keys())
self.lsp_fulltable.update(self.cpu_bound.lsp_table)
assert self.lsp_fulltable.keys().isdisjoint(self.blocking.lsp_table.keys())
self.lsp_fulltable.update(self.blocking.lsp_table)
def connect(self, connection):
self.connection = connection
def lsp_initialize(self, **kwargs) -> Dict:
# InitializeParams -> InitializeResult
self.lsp_data['processId'] = kwargs['processId']
self.lsp_data['rootUri'] = kwargs['rootUri']
self.lsp_data['clientCapabilities'] = kwargs['capabilities']
return {'capabilities': self.lsp_data['serverCapabilities'],
'serverInfo': self.lsp_data['serverInfo']}
def lsp_initialized(self, params: InitializedParams) -> None:
pass
def lsp_shutdown(self) -> Dict:
self.lsp_data['processId'] = 0
self.lsp_data['rootUri'] = ''
self.lsp_data['clientCapabilities'] = dict()
return {}
if __name__ == "__main__":
print("A small self-test of DHParser.lsp")
print(DocumentSymbol.__required_keys__)