Types

LSP type definitions in pygls are provided by the lsprotocol library

class lsprotocol.types.AnnotatedTextEdit(annotation_id, range, new_text)

A special text edit with an additional change annotation.

LSP v3.16.0.

Parameters:
annotation_id: str

The actual identifier of the change annotation

new_text: str

The string to be inserted. For delete operations use an empty string.

range: Range

The range of the text document to be manipulated. To insert text into a document create a range where start === end.

class lsprotocol.types.ApplyKind(value)

Defines how values from a set of defaults and an individual item will be merged.

LSP v3.18.0

Merge = 2

The value from the item will be merged with the default.

The specific rules for mergeing values are defined against each field that supports merging.

Replace = 1

The value from the individual item (if provided and not null ) will be used instead of the default.

class lsprotocol.types.ApplyWorkspaceEditParams(edit, label=None, metadata=None)

The parameters passed via an apply workspace edit request.

Parameters:
edit: WorkspaceEdit

The edits to apply.

label: str | None

An optional label of the workspace edit. This label is presented in the user interface for example on an undo stack to undo the workspace edit.

metadata: WorkspaceEditMetadata | None

Additional data about the edit.

LSP v3.18.0 @proposed

class lsprotocol.types.ApplyWorkspaceEditRequest(id, params, method='workspace/applyEdit', jsonrpc='2.0')

A request sent from the server to the client to modified certain resources.

Parameters:
id: int | str

The request id.

jsonrpc: str
method: Literal['workspace/applyEdit']

The method to be invoked.

params: ApplyWorkspaceEditParams
class lsprotocol.types.ApplyWorkspaceEditResponse(id, result=None, jsonrpc='2.0')
Parameters:
id: int | str | None

The request id.

jsonrpc: str
result: ApplyWorkspaceEditResult
class lsprotocol.types.ApplyWorkspaceEditResult(applied, failure_reason=None, failed_change=None)

The result returned from the apply workspace edit request.

LSP v3.17 renamed from ApplyWorkspaceEditResponse

Parameters:
  • applied (bool)

  • failure_reason (str | None)

  • failed_change (int | None)

applied: bool

Indicates whether the edit was applied or not.

failed_change: int | None

Depending on the client’s failure handling strategy failedChange might contain the index of the change that failed. This property is only available if the client signals a failureHandlingStrategy in its client capabilities.

failure_reason: str | None

An optional textual description for why the edit was not applied. This may be used by the server for diagnostic logging or to provide a suitable error for a request that triggered the edit.

class lsprotocol.types.BaseSymbolInformation(name, kind, tags=None, container_name=None)

A base for all symbol information.

Parameters:
container_name: str | None

The name of the symbol containing this symbol. This information is for user interface purposes (e.g. to render a qualifier in the user interface if necessary). It can’t be used to re-infer a hierarchy for the document symbols.

kind: SymbolKind

The kind of this symbol.

name: str

The name of this symbol.

tags: Sequence[SymbolTag] | None

Tags for this symbol.

LSP v3.16.0

class lsprotocol.types.CallHierarchyClientCapabilities(dynamic_registration=None)

LSP v3.16.0

Parameters:

dynamic_registration (bool | None)

dynamic_registration: bool | None

Whether implementation supports dynamic registration. If this is set to true the client supports the new (TextDocumentRegistrationOptions & StaticRegistrationOptions) return value for the corresponding server capability as well.

class lsprotocol.types.CallHierarchyIncomingCall(from_, from_ranges)

Represents an incoming call, e.g. a caller of a method or constructor.

LSP v3.16.0

Parameters:
from_: CallHierarchyItem

The item that makes the call.

from_ranges: Sequence[Range]

The ranges at which the calls appear. This is relative to the caller denoted by {@link CallHierarchyIncomingCall.from this.from }.

class lsprotocol.types.CallHierarchyIncomingCallsParams(item, work_done_token=None, partial_result_token=None)

The parameter of a callHierarchy/incomingCalls request.

LSP v3.16.0

Parameters:
item: CallHierarchyItem
partial_result_token: int | str | None

An optional token that a server can use to report partial results (e.g. streaming) to the client.

work_done_token: int | str | None

An optional token that a server can use to report work done progress.

class lsprotocol.types.CallHierarchyIncomingCallsRequest(id, params, method='callHierarchy/incomingCalls', jsonrpc='2.0')

A request to resolve the incoming calls for a given CallHierarchyItem .

LSP v3.16.0

Parameters:
id: int | str

The request id.

jsonrpc: str
method: Literal['callHierarchy/incomingCalls']

The method to be invoked.

params: CallHierarchyIncomingCallsParams
class lsprotocol.types.CallHierarchyIncomingCallsResponse(id, result=None, jsonrpc='2.0')
Parameters:
id: int | str | None

The request id.

jsonrpc: str
result: Sequence[CallHierarchyIncomingCall] | None
class lsprotocol.types.CallHierarchyItem(name, kind, uri, range, selection_range, tags=None, detail=None, data=None)

Represents programming constructs like functions or constructors in the context of call hierarchy.

LSP v3.16.0

Parameters:
data: Any | None

A data entry field that is preserved between a call hierarchy prepare and incoming calls or outgoing calls requests.

detail: str | None

More detail for this item, e.g. the signature of a function.

kind: SymbolKind

The kind of this item.

name: str

The name of this item.

range: Range

The range enclosing this symbol not including leading/trailing whitespace but everything else, e.g. comments and code.

selection_range: Range

The range that should be selected and revealed when this symbol is being picked, e.g. the name of a function. Must be contained by the {@link CallHierarchyItem.range range }.

tags: Sequence[SymbolTag] | None

Tags for this item.

uri: str

The resource identifier of this item.

class lsprotocol.types.CallHierarchyOptions(work_done_progress=None)

Call hierarchy options used during static registration.

LSP v3.16.0

Parameters:

work_done_progress (bool | None)

work_done_progress: bool | None
class lsprotocol.types.CallHierarchyOutgoingCall(to, from_ranges)

Represents an outgoing call, e.g. calling a getter from a method or a method from a constructor etc.

LSP v3.16.0

Parameters:
from_ranges: Sequence[Range]

The range at which this item is called. This is the range relative to the caller, e.g the item passed to {@link CallHierarchyItemProvider.provideCallHierarchyOutgoingCalls provideCallHierarchyOutgoingCalls } and not {@link CallHierarchyOutgoingCall.to this.to }.

to: CallHierarchyItem

The item that is called.

class lsprotocol.types.CallHierarchyOutgoingCallsParams(item, work_done_token=None, partial_result_token=None)

The parameter of a callHierarchy/outgoingCalls request.

LSP v3.16.0

Parameters:
item: CallHierarchyItem
partial_result_token: int | str | None

An optional token that a server can use to report partial results (e.g. streaming) to the client.

work_done_token: int | str | None

An optional token that a server can use to report work done progress.

class lsprotocol.types.CallHierarchyOutgoingCallsRequest(id, params, method='callHierarchy/outgoingCalls', jsonrpc='2.0')

A request to resolve the outgoing calls for a given CallHierarchyItem .

LSP v3.16.0

Parameters:
id: int | str

The request id.

jsonrpc: str
method: Literal['callHierarchy/outgoingCalls']

The method to be invoked.

params: CallHierarchyOutgoingCallsParams
class lsprotocol.types.CallHierarchyOutgoingCallsResponse(id, result=None, jsonrpc='2.0')
Parameters:
id: int | str | None

The request id.

jsonrpc: str
result: Sequence[CallHierarchyOutgoingCall] | None
class lsprotocol.types.CallHierarchyPrepareParams(text_document, position, work_done_token=None)

The parameter of a textDocument/prepareCallHierarchy request.

LSP v3.16.0

Parameters:
position: Position

The position inside the text document.

text_document: TextDocumentIdentifier

The text document.

work_done_token: int | str | None

An optional token that a server can use to report work done progress.

class lsprotocol.types.CallHierarchyPrepareRequest(id, params, method='textDocument/prepareCallHierarchy', jsonrpc='2.0')

A request to result a CallHierarchyItem in a document at a given position. Can be used as an input to an incoming or outgoing call hierarchy.

LSP v3.16.0

Parameters:
id: int | str

The request id.

jsonrpc: str
method: Literal['textDocument/prepareCallHierarchy']

The method to be invoked.

params: CallHierarchyPrepareParams
class lsprotocol.types.CallHierarchyPrepareResponse(id, result=None, jsonrpc='2.0')
Parameters:
id: int | str | None

The request id.

jsonrpc: str
result: Sequence[CallHierarchyItem] | None
class lsprotocol.types.CallHierarchyRegistrationOptions(document_selector=None, work_done_progress=None, id=None)

Call hierarchy options used during static or dynamic registration.

LSP v3.16.0

Parameters:
document_selector: Sequence[TextDocumentFilterLanguage | TextDocumentFilterScheme | TextDocumentFilterPattern | NotebookCellTextDocumentFilter] | None

A document selector to identify the scope of the registration. If set to null the document selector provided on the client side will be used.

id: str | None

The id used to register the request. The id can be used to deregister the request again. See also Registration#id.

work_done_progress: bool | None
class lsprotocol.types.CancelNotification(params, method='$/cancelRequest', jsonrpc='2.0')
Parameters:
jsonrpc: str
method: Literal['$/cancelRequest']

The method to be invoked.

params: CancelParams
class lsprotocol.types.CancelParams(id)
Parameters:

id (int | str)

id: int | str

The request id to cancel.

class lsprotocol.types.ChangeAnnotation(label, needs_confirmation=None, description=None)

Additional information that describes document changes.

LSP v3.16.0

Parameters:
  • label (str)

  • needs_confirmation (bool | None)

  • description (str | None)

description: str | None

A human-readable string which is rendered less prominent in the user interface.

label: str

A human-readable string describing the actual change. The string is rendered prominent in the user interface.

needs_confirmation: bool | None

A flag which indicates that user confirmation is needed before applying the change.

lsprotocol.types.ChangeAnnotationIdentifier

An identifier to refer to a change annotation stored with a workspace edit.

class lsprotocol.types.ChangeAnnotationsSupportOptions(groups_on_label=None)

LSP v3.18.0

Parameters:

groups_on_label (bool | None)

groups_on_label: bool | None

Whether the client groups edits with equal labels into tree nodes, for instance all edits labelled with “Changes in Strings” would be a tree node.

class lsprotocol.types.ClientCapabilities(workspace=None, text_document=None, notebook_document=None, window=None, general=None, experimental=None)

Defines the capabilities provided by the client.

Parameters:
experimental: Any | None

Experimental client capabilities.

general: GeneralClientCapabilities | None

General client capabilities.

LSP v3.16.0

notebook_document: NotebookDocumentClientCapabilities | None

Capabilities specific to the notebook document support.

LSP v3.17.0

text_document: TextDocumentClientCapabilities | None

Text document specific client capabilities.

window: WindowClientCapabilities | None

Window specific client capabilities.

workspace: WorkspaceClientCapabilities | None

Workspace specific client capabilities.

class lsprotocol.types.ClientCodeActionKindOptions(value_set)

LSP v3.18.0

Parameters:

value_set (Sequence[CodeActionKind | str])

value_set: Sequence[CodeActionKind | str]

The code action kind values the client supports. When this property exists the client also guarantees that it will handle values outside its set gracefully and falls back to a default value when unknown.

class lsprotocol.types.ClientCodeActionLiteralOptions(code_action_kind)

LSP v3.18.0

Parameters:

code_action_kind (ClientCodeActionKindOptions)

code_action_kind: ClientCodeActionKindOptions

The code action kind is support with the following value set.

class lsprotocol.types.ClientCodeActionResolveOptions(properties)

LSP v3.18.0

Parameters:

properties (Sequence[str])

properties: Sequence[str]

The properties that a client can resolve lazily.

class lsprotocol.types.ClientCodeLensResolveOptions(properties)

LSP v3.18.0

Parameters:

properties (Sequence[str])

properties: Sequence[str]

The properties that a client can resolve lazily.

class lsprotocol.types.ClientCompletionItemInsertTextModeOptions(value_set)

LSP v3.18.0

Parameters:

value_set (Sequence[InsertTextMode])

value_set: Sequence[InsertTextMode]
class lsprotocol.types.ClientCompletionItemOptions(snippet_support=None, commit_characters_support=None, documentation_format=None, deprecated_support=None, preselect_support=None, tag_support=None, insert_replace_support=None, resolve_support=None, insert_text_mode_support=None, label_details_support=None)

LSP v3.18.0

Parameters:
commit_characters_support: bool | None

Client supports commit characters on a completion item.

deprecated_support: bool | None

Client supports the deprecated property on a completion item.

documentation_format: Sequence[MarkupKind] | None

Client supports the following content formats for the documentation property. The order describes the preferred format of the client.

insert_replace_support: bool | None

Client support insert replace edit to control different behavior if a completion item is inserted in the text or should replace text.

LSP v3.16.0

insert_text_mode_support: ClientCompletionItemInsertTextModeOptions | None

The client supports the insertTextMode property on a completion item to override the whitespace handling mode as defined by the client (see insertTextMode ).

LSP v3.16.0

label_details_support: bool | None

The client has support for completion item label details (see also CompletionItemLabelDetails ).

LSP v3.17.0

preselect_support: bool | None

Client supports the preselect property on a completion item.

resolve_support: ClientCompletionItemResolveOptions | None

Indicates which properties a client can resolve lazily on a completion item. Before version 3.16.0 only the predefined properties documentation and details could be resolved lazily.

LSP v3.16.0

snippet_support: bool | None

Client supports snippets as insert text.

A snippet can define tab stops and placeholders with $1 , $2 and ${3:foo} . $0 defines the final tab stop, it defaults to the end of the snippet. Placeholders with equal identifiers are linked, that is typing in one will update others too.

tag_support: CompletionItemTagOptions | None

Client supports the tag property on a completion item. Clients supporting tags have to handle unknown tags gracefully. Clients especially need to preserve unknown tags when sending a completion item back to the server in a resolve call.

LSP v3.15.0

class lsprotocol.types.ClientCompletionItemOptionsKind(value_set=None)

LSP v3.18.0

Parameters:

value_set (Sequence[CompletionItemKind | int] | None)

value_set: Sequence[CompletionItemKind | int] | None

The completion item kind values the client supports. When this property exists the client also guarantees that it will handle values outside its set gracefully and falls back to a default value when unknown.

If this property is not present the client only supports the completion items kinds from Text to Reference as defined in the initial version of the protocol.

class lsprotocol.types.ClientCompletionItemResolveOptions(properties)

LSP v3.18.0

Parameters:

properties (Sequence[str])

properties: Sequence[str]

The properties that a client can resolve lazily.

class lsprotocol.types.ClientDiagnosticsTagOptions(value_set)

LSP v3.18.0

Parameters:

value_set (Sequence[DiagnosticTag])

value_set: Sequence[DiagnosticTag]

The tags supported by the client.

class lsprotocol.types.ClientFoldingRangeKindOptions(value_set=None)

LSP v3.18.0

Parameters:

value_set (Sequence[FoldingRangeKind | str] | None)

value_set: Sequence[FoldingRangeKind | str] | None

The folding range kind values the client supports. When this property exists the client also guarantees that it will handle values outside its set gracefully and falls back to a default value when unknown.

class lsprotocol.types.ClientFoldingRangeOptions(collapsed_text=None)

LSP v3.18.0

Parameters:

collapsed_text (bool | None)

collapsed_text: bool | None

If set, the client signals that it supports setting collapsedText on folding ranges to display custom labels instead of the default text.

LSP v3.17.0

class lsprotocol.types.ClientInfo(name, version=None)

Information about the client

LSP v3.15.0 LSP v3.18.0 ClientInfo type name added.

Parameters:
  • name (str)

  • version (str | None)

name: str

The name of the client as defined by the client.

version: str | None

The client’s version as defined by the client.

class lsprotocol.types.ClientInlayHintResolveOptions(properties)

LSP v3.18.0

Parameters:

properties (Sequence[str])

properties: Sequence[str]

The properties that a client can resolve lazily.

class lsprotocol.types.ClientSemanticTokensRequestFullDelta(delta=None)

LSP v3.18.0

Parameters:

delta (bool | None)

delta: bool | None

The client will send the textDocument/semanticTokens/full/delta request if the server provides a corresponding handler.

class lsprotocol.types.ClientSemanticTokensRequestOptions(range=None, full=None)

LSP v3.18.0

Parameters:
full: bool | ClientSemanticTokensRequestFullDelta | None

The client will send the textDocument/semanticTokens/full request if the server provides a corresponding handler.

range: bool | Any | None

The client will send the textDocument/semanticTokens/range request if the server provides a corresponding handler.

class lsprotocol.types.ClientShowMessageActionItemOptions(additional_properties_support=None)

LSP v3.18.0

Parameters:

additional_properties_support (bool | None)

additional_properties_support: bool | None

Whether the client supports additional attributes which are preserved and send back to the server in the request’s response.

class lsprotocol.types.ClientSignatureInformationOptions(documentation_format=None, parameter_information=None, active_parameter_support=None, no_active_parameter_support=None)

LSP v3.18.0

Parameters:
active_parameter_support: bool | None

The client supports the activeParameter property on SignatureInformation literal.

LSP v3.16.0

documentation_format: Sequence[MarkupKind] | None

Client supports the following content formats for the documentation property. The order describes the preferred format of the client.

no_active_parameter_support: bool | None

The client supports the activeParameter property on SignatureHelp /SignatureInformation being set to null to indicate that no parameter should be active.

LSP v3.18.0 @proposed

parameter_information: ClientSignatureParameterInformationOptions | None

Client capabilities specific to parameter information.

class lsprotocol.types.ClientSignatureParameterInformationOptions(label_offset_support=None)

LSP v3.18.0

Parameters:

label_offset_support (bool | None)

label_offset_support: bool | None

The client supports processing label offsets instead of a simple label string.

LSP v3.14.0

class lsprotocol.types.ClientSymbolKindOptions(value_set=None)

LSP v3.18.0

Parameters:

value_set (Sequence[SymbolKind] | None)

value_set: Sequence[SymbolKind] | None

The symbol kind values the client supports. When this property exists the client also guarantees that it will handle values outside its set gracefully and falls back to a default value when unknown.

If this property is not present the client only supports the symbol kinds from File to Array as defined in the initial version of the protocol.

class lsprotocol.types.ClientSymbolResolveOptions(properties)

LSP v3.18.0

Parameters:

properties (Sequence[str])

properties: Sequence[str]

The properties that a client can resolve lazily. Usually location.range

class lsprotocol.types.ClientSymbolTagOptions(value_set)

LSP v3.18.0

Parameters:

value_set (Sequence[SymbolTag])

value_set: Sequence[SymbolTag]

The tags supported by the client.

class lsprotocol.types.CodeAction(title, kind=None, diagnostics=None, is_preferred=None, disabled=None, edit=None, command=None, data=None, tags=None)

A code action represents a change that can be performed in code, e.g. to fix a problem or to refactor code.

A CodeAction must set either edit and/or a command. If both are supplied, the edit is applied first, then the command is executed.

Parameters:
command: Command | None

A command this code action executes. If a code action provides an edit and a command, first the edit is executed and then the command.

data: Any | None

A data entry field that is preserved on a code action between a textDocument/codeAction and a codeAction/resolve request.

LSP v3.16.0

diagnostics: Sequence[Diagnostic] | None

The diagnostics that this code action resolves.

disabled: CodeActionDisabled | None

Marks that the code action cannot currently be applied.

Clients should follow the following guidelines regarding disabled code actions:

  • Disabled code actions are not shown in automatic lightbulbs code action menus.

  • Disabled actions are shown as faded out in the code action menu when the user requests a more specific type of code action, such as refactorings.

  • If the user has a keybinding that auto applies a code action and only disabled code actions are returned, the client should show the user an error message with reason in the editor.

LSP v3.16.0

edit: WorkspaceEdit | None

The workspace edit this code action performs.

is_preferred: bool | None

Marks this as a preferred action. Preferred actions are used by the auto fix command and can be targeted by keybindings.

A quick fix should be marked preferred if it properly addresses the underlying error. A refactoring should be marked preferred if it is the most reasonable choice of actions to take.

LSP v3.15.0

kind: CodeActionKind | str | None

The kind of the code action.

Used to filter code actions.

tags: Sequence[CodeActionTag] | None

Tags for this code action.

LSP v3.18.0 - proposed

title: str

A short, human-readable, title for this code action.

class lsprotocol.types.CodeActionClientCapabilities(dynamic_registration=None, code_action_literal_support=None, is_preferred_support=None, disabled_support=None, data_support=None, resolve_support=None, honors_change_annotations=None, documentation_support=None, tag_support=None)

The Client Capabilities of a CodeActionRequest.

Parameters:
code_action_literal_support: ClientCodeActionLiteralOptions | None

The client support code action literals of type CodeAction as a valid response of the textDocument/codeAction request. If the property is not set the request can only return Command literals.

LSP v3.8.0

data_support: bool | None

Whether code action supports the data property which is preserved between a textDocument/codeAction and a codeAction/resolve request.

LSP v3.16.0

disabled_support: bool | None

Whether code action supports the disabled property.

LSP v3.16.0

documentation_support: bool | None

Whether the client supports documentation for a class of code actions.

LSP v3.18.0 @proposed

dynamic_registration: bool | None

Whether code action supports dynamic registration.

honors_change_annotations: bool | None

Whether the client honors the change annotations in text edits and resource operations returned via the CodeAction#edit property by for example presenting the workspace edit in the user interface and asking for confirmation.

LSP v3.16.0

is_preferred_support: bool | None

Whether code action supports the isPreferred property.

LSP v3.15.0

resolve_support: ClientCodeActionResolveOptions | None

Whether the client supports resolving additional code action properties via a separate codeAction/resolve request.

LSP v3.16.0

tag_support: CodeActionTagOptions | None

Client supports the tag property on a code action. Clients supporting tags have to handle unknown tags gracefully.

LSP v3.18.0 - proposed

class lsprotocol.types.CodeActionContext(diagnostics, only=None, trigger_kind=None)

Contains additional diagnostic information about the context in which a provideCodeActions code action is run.

Parameters:
diagnostics: Sequence[Diagnostic]

An array of diagnostics known on the client side overlapping the range provided to the textDocument/codeAction request. They are provided so that the server knows which errors are currently presented to the user for the given range. There is no guarantee that these accurately reflect the error state of the resource. The primary parameter to compute code actions is the provided range.

only: Sequence[CodeActionKind | str] | None

Requested kind of actions to return.

Actions not of this kind are filtered out by the client before being shown. So servers can omit computing them.

trigger_kind: CodeActionTriggerKind | None

The reason why code actions were requested.

LSP v3.17.0

class lsprotocol.types.CodeActionDisabled(reason)

Captures why the code action is currently disabled.

LSP v3.18.0

Parameters:

reason (str)

reason: str

Human readable description of why the code action is currently disabled.

This is displayed in the code actions UI.

class lsprotocol.types.CodeActionKind(value)

A set of predefined code action kinds

Empty = ''

Empty kind.

Notebook = 'notebook'

Base kind for all code actions applying to the entire notebook’s scope. CodeActionKinds using this should always begin with notebook.

LSP v3.18.0

QuickFix = 'quickfix'

‘quickfix’

Type:

Base kind for quickfix actions

Refactor = 'refactor'

‘refactor’

Type:

Base kind for refactoring actions

RefactorExtract = 'refactor.extract'

‘refactor.extract’

Example extract actions:

  • Extract method

  • Extract function

  • Extract variable

  • Extract interface from class

Type:

Base kind for refactoring extraction actions

RefactorInline = 'refactor.inline'

‘refactor.inline’

Example inline actions:

  • Inline function

  • Inline variable

  • Inline constant

Type:

Base kind for refactoring inline actions

RefactorMove = 'refactor.move'

refactor.move

Example move actions:

  • Move a function to a new file

  • Move a property between classes

  • Move method to base class

LSP v3.18.0 @proposed

Type:

Base kind for refactoring move actions

RefactorRewrite = 'refactor.rewrite'

‘refactor.rewrite’

Example rewrite actions:

  • Convert JavaScript function to class

  • Add or remove parameter

  • Encapsulate field

  • Make method static

  • Move method to base class

Type:

Base kind for refactoring rewrite actions

Source = 'source'

source

Source code actions apply to the entire file.

Type:

Base kind for source actions

SourceFixAll = 'source.fixAll'

source.fixAll .

Fix all actions automatically fix errors that have a clear fix that do not require user input. They should not suppress errors or perform unsafe fixes such as generating new types or classes.

LSP v3.15.0

Type:

Base kind for auto-fix source actions

SourceOrganizeImports = 'source.organizeImports'

source.organizeImports

Type:

Base kind for an organize imports source action

class lsprotocol.types.CodeActionKindDocumentation(kind, command)

Documentation for a class of code actions.

LSP v3.18.0 @proposed

Parameters:
command: Command

Command that is ued to display the documentation to the user.

The title of this documentation code action is taken from {@linkcode Command.title}

kind: CodeActionKind | str

The kind of the code action being documented.

If the kind is generic, such as CodeActionKind.Refactor , the documentation will be shown whenever any refactorings are returned. If the kind if more specific, such as CodeActionKind.RefactorExtract , the documentation will only be shown when extract refactoring code actions are returned.

class lsprotocol.types.CodeActionOptions(code_action_kinds=None, documentation=None, resolve_provider=None, work_done_progress=None)

Provider options for a CodeActionRequest.

Parameters:
code_action_kinds: Sequence[CodeActionKind | str] | None

CodeActionKinds that this server may return.

The list of kinds may be generic, such as CodeActionKind.Refactor , or the server may list out every specific kind they provide.

documentation: Sequence[CodeActionKindDocumentation] | None

Static documentation for a class of code actions.

Documentation from the provider should be shown in the code actions menu if either:

  • Code actions of kind are requested by the editor. In this case, the editor will show the documentation that most closely matches the requested code action kind. For example, if a provider has documentation for both Refactor and RefactorExtract, when the user requests code actions for RefactorExtract, the editor will use the documentation for RefactorExtract instead of the documentation for Refactor.

  • Any code actions of kind are returned by the provider.

At most one documentation entry should be shown per provider.

LSP v3.18.0 @proposed

resolve_provider: bool | None

The server provides support to resolve additional information for a code action.

LSP v3.16.0

work_done_progress: bool | None
class lsprotocol.types.CodeActionParams(text_document, range, context, work_done_token=None, partial_result_token=None)

The parameters of a CodeActionRequest.

Parameters:
context: CodeActionContext

Context carrying additional information.

partial_result_token: int | str | None

An optional token that a server can use to report partial results (e.g. streaming) to the client.

range: Range

The range for which the command was invoked.

text_document: TextDocumentIdentifier

The document in which the command was invoked.

work_done_token: int | str | None

An optional token that a server can use to report work done progress.

class lsprotocol.types.CodeActionRegistrationOptions(document_selector=None, code_action_kinds=None, documentation=None, resolve_provider=None, work_done_progress=None)

Registration options for a CodeActionRequest.

Parameters:
code_action_kinds: Sequence[CodeActionKind | str] | None

CodeActionKinds that this server may return.

The list of kinds may be generic, such as CodeActionKind.Refactor , or the server may list out every specific kind they provide.

document_selector: Sequence[TextDocumentFilterLanguage | TextDocumentFilterScheme | TextDocumentFilterPattern | NotebookCellTextDocumentFilter] | None

A document selector to identify the scope of the registration. If set to null the document selector provided on the client side will be used.

documentation: Sequence[CodeActionKindDocumentation] | None

Static documentation for a class of code actions.

Documentation from the provider should be shown in the code actions menu if either:

  • Code actions of kind are requested by the editor. In this case, the editor will show the documentation that most closely matches the requested code action kind. For example, if a provider has documentation for both Refactor and RefactorExtract, when the user requests code actions for RefactorExtract, the editor will use the documentation for RefactorExtract instead of the documentation for Refactor.

  • Any code actions of kind are returned by the provider.

At most one documentation entry should be shown per provider.

LSP v3.18.0 @proposed

resolve_provider: bool | None

The server provides support to resolve additional information for a code action.

LSP v3.16.0

work_done_progress: bool | None
class lsprotocol.types.CodeActionRequest(id, params, method='textDocument/codeAction', jsonrpc='2.0')

A request to provide commands for the given text document and range.

Parameters:
id: int | str

The request id.

jsonrpc: str
method: Literal['textDocument/codeAction']

The method to be invoked.

params: CodeActionParams
class lsprotocol.types.CodeActionResolveRequest(id, params, method='codeAction/resolve', jsonrpc='2.0')

Request to resolve additional information for a given code action.The request’s parameter is of type CodeAction the response is of type CodeAction or a Thenable that resolves to such.

Parameters:
id: int | str

The request id.

jsonrpc: str
method: Literal['codeAction/resolve']

The method to be invoked.

params: CodeAction
class lsprotocol.types.CodeActionResolveResponse(id, result=None, jsonrpc='2.0')
Parameters:
id: int | str | None

The request id.

jsonrpc: str
result: CodeAction
class lsprotocol.types.CodeActionResponse(id, result=None, jsonrpc='2.0')
Parameters:
id: int | str | None

The request id.

jsonrpc: str
result: Sequence[Command | CodeAction] | None
class lsprotocol.types.CodeActionTag(value)

Code action tags are extra annotations that tweak the behavior of a code action.

LSP v3.18.0 - proposed

LlmGenerated = 1

Marks the code action as LLM-generated.

class lsprotocol.types.CodeActionTagOptions(value_set)

LSP v3.18.0 - proposed

Parameters:

value_set (Sequence[CodeActionTag])

value_set: Sequence[CodeActionTag]

The tags supported by the client.

class lsprotocol.types.CodeActionTriggerKind(value)

The reason why code actions were requested.

LSP v3.17.0

Automatic = 2

Code actions were requested automatically.

This typically happens when current selection in a file changes, but can also be triggered when file content changes.

Invoked = 1

Code actions were explicitly requested by the user or by an extension.

class lsprotocol.types.CodeDescription(href)

Structure to capture a description for an error code.

LSP v3.16.0

Parameters:

href (str)

href: str

An URI to open with more information about the diagnostic error.

class lsprotocol.types.CodeLens(range, command=None, data=None)

A code lens represents a Command command that should be shown along with source text, like the number of references, a way to run tests, etc.

A code lens is _unresolved_ when no command is associated to it. For performance reasons the creation of a code lens and resolving should be done in two stages.

Parameters:
command: Command | None

The command this code lens represents.

data: Any | None

A data entry field that is preserved on a code lens item between a CodeLensRequest and a {@link CodeLensResolveRequest}

range: Range

The range in which this code lens is valid. Should only span a single line.

class lsprotocol.types.CodeLensClientCapabilities(dynamic_registration=None, resolve_support=None)

The client capabilities of a CodeLensRequest.

Parameters:
dynamic_registration: bool | None

Whether code lens supports dynamic registration.

resolve_support: ClientCodeLensResolveOptions | None

Whether the client supports resolving additional code lens properties via a separate codeLens/resolve request.

LSP v3.18.0

class lsprotocol.types.CodeLensOptions(resolve_provider=None, work_done_progress=None)

Code Lens provider options of a CodeLensRequest.

Parameters:
  • resolve_provider (bool | None)

  • work_done_progress (bool | None)

resolve_provider: bool | None

Code lens has a resolve provider as well.

work_done_progress: bool | None
class lsprotocol.types.CodeLensParams(text_document, work_done_token=None, partial_result_token=None)

The parameters of a CodeLensRequest.

Parameters:
partial_result_token: int | str | None

An optional token that a server can use to report partial results (e.g. streaming) to the client.

text_document: TextDocumentIdentifier

The document to request code lens for.

work_done_token: int | str | None

An optional token that a server can use to report work done progress.

class lsprotocol.types.CodeLensRefreshRequest(id, params=None, method='workspace/codeLens/refresh', jsonrpc='2.0')

A request to refresh all code actions

LSP v3.16.0

Parameters:
  • id (int | str)

  • params (None)

  • method (Literal['workspace/codeLens/refresh'])

  • jsonrpc (str)

id: int | str

The request id.

jsonrpc: str
method: Literal['workspace/codeLens/refresh']

The method to be invoked.

params: None
class lsprotocol.types.CodeLensRefreshResponse(id, result=None, jsonrpc='2.0')
Parameters:
  • id (int | str | None)

  • result (None)

  • jsonrpc (str)

id: int | str | None

The request id.

jsonrpc: str
result: None
class lsprotocol.types.CodeLensRegistrationOptions(document_selector=None, resolve_provider=None, work_done_progress=None)

Registration options for a CodeLensRequest.

Parameters:
document_selector: Sequence[TextDocumentFilterLanguage | TextDocumentFilterScheme | TextDocumentFilterPattern | NotebookCellTextDocumentFilter] | None

A document selector to identify the scope of the registration. If set to null the document selector provided on the client side will be used.

resolve_provider: bool | None

Code lens has a resolve provider as well.

work_done_progress: bool | None
class lsprotocol.types.CodeLensRequest(id, params, method='textDocument/codeLens', jsonrpc='2.0')

A request to provide code lens for the given text document.

Parameters:
id: int | str

The request id.

jsonrpc: str
method: Literal['textDocument/codeLens']

The method to be invoked.

params: CodeLensParams
class lsprotocol.types.CodeLensResolveRequest(id, params, method='codeLens/resolve', jsonrpc='2.0')

A request to resolve a command for a given code lens.

Parameters:
id: int | str

The request id.

jsonrpc: str
method: Literal['codeLens/resolve']

The method to be invoked.

params: CodeLens
class lsprotocol.types.CodeLensResolveResponse(id, result=None, jsonrpc='2.0')
Parameters:
id: int | str | None

The request id.

jsonrpc: str
result: CodeLens
class lsprotocol.types.CodeLensResponse(id, result=None, jsonrpc='2.0')
Parameters:
id: int | str | None

The request id.

jsonrpc: str
result: Sequence[CodeLens] | None
class lsprotocol.types.CodeLensWorkspaceClientCapabilities(refresh_support=None)

LSP v3.16.0

Parameters:

refresh_support (bool | None)

refresh_support: bool | None

Whether the client implementation supports a refresh request sent from the server to the client.

Note that this event is global and will force the client to refresh all code lenses currently shown. It should be used with absolute care and is useful for situation where a server for example detect a project wide change that requires such a calculation.

class lsprotocol.types.Color(red, green, blue, alpha)

Represents a color in RGBA space.

Parameters:
alpha: float

The alpha component of this color in the range [0-1].

blue: float

The blue component of this color in the range [0-1].

green: float

The green component of this color in the range [0-1].

red: float

The red component of this color in the range [0-1].

class lsprotocol.types.ColorInformation(range, color)

Represents a color range from a document.

Parameters:
color: Color

The actual color value for this color range.

range: Range

The range in the document where this color appears.

class lsprotocol.types.ColorPresentation(label, text_edit=None, additional_text_edits=None)
Parameters:
additional_text_edits: Sequence[TextEdit] | None

An optional array of additional TextEdit text edits that are applied when selecting this color presentation. Edits must not overlap with the main textEdit edit nor with themselves.

label: str

The label of this color presentation. It will be shown on the color picker header. By default this is also the text that is inserted when selecting this color presentation.

text_edit: TextEdit | None

An TextEdit edit which is applied to a document when selecting this presentation for the color. When falsy the {@link ColorPresentation.label label} is used.

class lsprotocol.types.ColorPresentationParams(text_document, color, range, work_done_token=None, partial_result_token=None)

Parameters for a ColorPresentationRequest.

Parameters:
color: Color

The color to request presentations for.

partial_result_token: int | str | None

An optional token that a server can use to report partial results (e.g. streaming) to the client.

range: Range

The range where the color would be inserted. Serves as a context.

text_document: TextDocumentIdentifier

The text document.

work_done_token: int | str | None

An optional token that a server can use to report work done progress.

class lsprotocol.types.ColorPresentationRequest(id, params, method='textDocument/colorPresentation', jsonrpc='2.0')

A request to list all presentation for a color. The request’s parameter is of type ColorPresentationParams the response is of type ColorInformation ColorInformation[] or a Thenable that resolves to such.

Parameters:
id: int | str

The request id.

jsonrpc: str
method: Literal['textDocument/colorPresentation']

The method to be invoked.

params: ColorPresentationParams
class lsprotocol.types.ColorPresentationRequestOptions(work_done_progress=None, document_selector=None)
Parameters:
document_selector: Sequence[TextDocumentFilterLanguage | TextDocumentFilterScheme | TextDocumentFilterPattern | NotebookCellTextDocumentFilter] | None

A document selector to identify the scope of the registration. If set to null the document selector provided on the client side will be used.

work_done_progress: bool | None
class lsprotocol.types.ColorPresentationResponse(id, result=None, jsonrpc='2.0')
Parameters:
id: int | str | None

The request id.

jsonrpc: str
result: Sequence[ColorPresentation]
class lsprotocol.types.Command(title, command, tooltip=None, arguments=None)

Represents a reference to a command. Provides a title which will be used to represent a command in the UI and, optionally, an array of arguments which will be passed to the command handler function when invoked.

Parameters:
arguments: Sequence[Any | None] | None

Arguments that the command handler should be invoked with.

command: str

The identifier of the actual command handler.

title: str

Title of the command, like save .

tooltip: str | None

An optional tooltip.

LSP v3.18.0 @proposed

class lsprotocol.types.CompletionClientCapabilities(dynamic_registration=None, completion_item=None, completion_item_kind=None, insert_text_mode=None, context_support=None, completion_list=None)

Completion client capabilities

Parameters:
completion_item: ClientCompletionItemOptions | None

The client supports the following CompletionItem specific capabilities.

completion_item_kind: ClientCompletionItemOptionsKind | None
completion_list: CompletionListCapabilities | None

The client supports the following CompletionList specific capabilities.

LSP v3.17.0

context_support: bool | None

The client supports to send additional context information for a textDocument/completion request.

dynamic_registration: bool | None

Whether completion supports dynamic registration.

insert_text_mode: InsertTextMode | None

Defines how the client handles whitespace and indentation when accepting a completion item that uses multi line text in either insertText or textEdit.

LSP v3.17.0

class lsprotocol.types.CompletionContext(trigger_kind, trigger_character=None)

Contains additional information about the context in which a completion request is triggered.

Parameters:
trigger_character: str | None

The trigger character (a single character) that has trigger code complete. Is undefined if triggerKind !== CompletionTriggerKind.TriggerCharacter

trigger_kind: CompletionTriggerKind

How the completion was triggered.

class lsprotocol.types.CompletionItem(label, label_details=None, kind=None, tags=None, detail=None, documentation=None, deprecated=None, preselect=None, sort_text=None, filter_text=None, insert_text=None, insert_text_format=None, insert_text_mode=None, text_edit=None, text_edit_text=None, additional_text_edits=None, commit_characters=None, command=None, data=None)

A completion item represents a text snippet that is proposed to complete text that is being typed.

Parameters:
additional_text_edits: Sequence[TextEdit] | None

An optional array of additional TextEdit text edits that are applied when selecting this completion. Edits must not overlap (including the same insert position) with the main textEdit edit nor with themselves.

Additional text edits should be used to change text unrelated to the current cursor position (for example adding an import statement at the top of the file if the completion item will insert an unqualified type).

command: Command | None

An optional Command command that is executed after inserting this completion. Note that additional modifications to the current document should be described with the additionalTextEdits additionalTextEdits-property.

commit_characters: Sequence[str] | None

An optional set of characters that when pressed while this completion is active will accept it first and then type that character. Note that all commit characters should have length=1 and that superfluous characters will be ignored.

data: Any | None

A data entry field that is preserved on a completion item between a CompletionRequest and a {@link CompletionResolveRequest}.

deprecated: bool | None

Indicates if this item is deprecated. @deprecated Use tags instead.

detail: str | None

A human-readable string with additional information about this item, like type or symbol information.

documentation: str | MarkupContent | None

A human-readable string that represents a doc-comment.

filter_text: str | None

A string that should be used when filtering a set of completion items. When falsy the {@link CompletionItem.label label} is used.

insert_text: str | None

A string that should be inserted into a document when selecting this completion. When falsy the {@link CompletionItem.label label} is used.

The insertText is subject to interpretation by the client side. Some tools might not take the string literally. For example VS Code when code complete is requested in this example con<cursor position> and a completion item with an insertText of console is provided it will only insert sole. Therefore it is recommended to use textEdit instead since it avoids additional client side interpretation.

insert_text_format: InsertTextFormat | None

The format of the insert text. The format applies to both the insertText property and the newText property of a provided textEdit . If omitted defaults to InsertTextFormat.PlainText.

Please note that the insertTextFormat doesn’t apply to additionalTextEdits .

insert_text_mode: InsertTextMode | None

How whitespace and indentation is handled during completion item insertion. If not provided the clients default value depends on the textDocument.completion.insertTextMode client capability.

LSP v3.16.0

kind: CompletionItemKind | int | None

The kind of this completion item. Based of the kind an icon is chosen by the editor.

label: str

The label of this completion item.

The label property is also by default the text that is inserted when selecting this completion.

If label details are provided the label itself should be an unqualified name of the completion item.

label_details: CompletionItemLabelDetails | None

Additional details for the label

LSP v3.17.0

preselect: bool | None

Select this item when showing.

Note that only one completion item can be selected and that the tool / client decides which item that is. The rule is that the first item of those that match best is selected.

sort_text: str | None

A string that should be used when comparing this item with other items. When falsy the {@link CompletionItem.label label} is used.

tags: Sequence[CompletionItemTag] | None

Tags for this completion item.

LSP v3.15.0

text_edit: TextEdit | InsertReplaceEdit | None

An TextEdit edit which is applied to a document when selecting this completion. When an edit is provided the value of insertText insertText is ignored.

Most editors support two different operations when accepting a completion item. One is to insert a completion text and the other is to replace an existing text with a completion text. Since this can usually not be predetermined by a server it can report both ranges. Clients need to signal support for InsertReplaceEdits via the textDocument.completion.insertReplaceSupport client capability property.

Note 1: The text edit’s range as well as both ranges from an insert replace edit must be a [single line] and they must contain the position at which completion has been requested. Note 2: If an InsertReplaceEdit is returned the edit’s insert range must be a prefix of the edit’s replace range, that means it must be contained and starting at the same position.

@since 3.16.0 additional type InsertReplaceEdit

text_edit_text: str | None

The edit text used if the completion item is part of a CompletionList and CompletionList defines an item default for the text edit range.

Clients will only honor this property if they opt into completion list item defaults using the capability completionList.itemDefaults .

If not provided and a list’s default range is provided the label property is used as a text.

LSP v3.17.0

class lsprotocol.types.CompletionItemApplyKinds(commit_characters=None, data=None)

Specifies how fields from a completion item should be combined with those from completionList.itemDefaults .

If unspecified, all fields will be treated as ApplyKind.Replace.

If a field’s value is ApplyKind.Replace, the value from a completion item (if provided and not null ) will always be used instead of the value from completionItem.itemDefaults .

If a field’s value is ApplyKind.Merge, the values will be merged using the rules defined against each field below.

Servers are only allowed to return applyKind if the client signals support for this via the completionList.applyKindSupport capability.

LSP v3.18.0

Parameters:
commit_characters: ApplyKind | None

Specifies whether commitCharacters on a completion will replace or be merged with those in completionList.itemDefaults.commitCharacters .

If ApplyKind.Replace, the commit characters from the completion item will always be used unless not provided, in which case those from completionList.itemDefaults.commitCharacters will be used. An empty list can be used if a completion item does not have any commit characters and also should not use those from completionList.itemDefaults.commitCharacters .

If ApplyKind.Merge the commitCharacters for the completion will be the union of all values in both completionList.itemDefaults.commitCharacters and the completion’s own commitCharacters .

LSP v3.18.0

data: ApplyKind | None

Specifies whether the data field on a completion will replace or be merged with data from completionList.itemDefaults.data .

If ApplyKind.Replace, the data from the completion item will be used if provided (and not null ), otherwise completionList.itemDefaults.data will be used. An empty object can be used if a completion item does not have any data but also should not use the value from completionList.itemDefaults.data .

If ApplyKind.Merge, a shallow merge will be performed between completionList.itemDefaults.data and the completion’s own data using the following rules:

  • If a completion’s data field is not provided (or null), the entire data field from completionList.itemDefaults.data will be used as-is.

  • If a completion’s data field is provided, each field will overwrite the field of the same name in completionList.itemDefaults.data but no merging of nested fields within that value will occur.

LSP v3.18.0

class lsprotocol.types.CompletionItemDefaults(commit_characters=None, edit_range=None, insert_text_format=None, insert_text_mode=None, data=None)

In many cases the items of an actual completion result share the same value for properties like commitCharacters or the range of a text edit. A completion list can therefore define item defaults which will be used if a completion item itself doesn’t specify the value.

If a completion list specifies a default value and a completion item also specifies a corresponding value, the rules for combining these are defined by applyKinds (if the client supports it), defaulting to ApplyKind.Replace.

Servers are only allowed to return default values if the client signals support for this via the completionList.itemDefaults capability.

LSP v3.17.0

Parameters:
commit_characters: Sequence[str] | None

A default commit character set.

LSP v3.17.0

data: Any | None

A default data value.

LSP v3.17.0

edit_range: Range | EditRangeWithInsertReplace | None

A default edit range.

LSP v3.17.0

insert_text_format: InsertTextFormat | None

A default insert text format.

LSP v3.17.0

insert_text_mode: InsertTextMode | None

A default insert text mode.

LSP v3.17.0

class lsprotocol.types.CompletionItemKind(value)

The kind of a completion entry.

Class = 7
Color = 16
Constant = 21
Constructor = 4
Enum = 13
EnumMember = 20
Event = 23
Field = 5
File = 17
Folder = 19
Function = 3
Interface = 8
Keyword = 14
Method = 2
Module = 9
Operator = 24
Property = 10
Reference = 18
Snippet = 15
Struct = 22
Text = 1
TypeParameter = 25
Unit = 11
Value = 12
Variable = 6
class lsprotocol.types.CompletionItemLabelDetails(detail=None, description=None)

Additional details for a completion item label.

LSP v3.17.0

Parameters:
  • detail (str | None)

  • description (str | None)

description: str | None

An optional string which is rendered less prominently after detail. Should be used for fully qualified names and file paths.

detail: str | None

An optional string which is rendered less prominently directly after label label, without any spacing. Should be used for function signatures and type annotations.

class lsprotocol.types.CompletionItemTag(value)

Completion item tags are extra annotations that tweak the rendering of a completion item.

LSP v3.15.0

Deprecated = 1

Render a completion as obsolete, usually using a strike-out.

class lsprotocol.types.CompletionItemTagOptions(value_set)

LSP v3.18.0

Parameters:

value_set (Sequence[CompletionItemTag])

value_set: Sequence[CompletionItemTag]

The tags supported by the client.

class lsprotocol.types.CompletionList(is_incomplete, items, item_defaults=None, apply_kind=None)

Represents a collection of CompletionItem completion items to be presented in the editor.

Parameters:
apply_kind: CompletionItemApplyKinds | None

Specifies how fields from a completion item should be combined with those from completionList.itemDefaults .

If unspecified, all fields will be treated as ApplyKind.Replace.

If a field’s value is ApplyKind.Replace, the value from a completion item (if provided and not null ) will always be used instead of the value from completionItem.itemDefaults .

If a field’s value is ApplyKind.Merge, the values will be merged using the rules defined against each field below.

Servers are only allowed to return applyKind if the client signals support for this via the completionList.applyKindSupport capability.

LSP v3.18.0

is_incomplete: bool

This list it not complete. Further typing results in recomputing this list.

Recomputed lists have all their items replaced (not appended) in the incomplete completion sessions.

item_defaults: CompletionItemDefaults | None

In many cases the items of an actual completion result share the same value for properties like commitCharacters or the range of a text edit. A completion list can therefore define item defaults which will be used if a completion item itself doesn’t specify the value.

If a completion list specifies a default value and a completion item also specifies a corresponding value, the rules for combining these are defined by applyKinds (if the client supports it), defaulting to ApplyKind.Replace.

Servers are only allowed to return default values if the client signals support for this via the completionList.itemDefaults capability.

LSP v3.17.0

items: Sequence[CompletionItem]

The completion items.

class lsprotocol.types.CompletionListCapabilities(item_defaults=None, apply_kind_support=None)

The client supports the following CompletionList specific capabilities.

LSP v3.17.0

Parameters:
apply_kind_support: bool | None

Specifies whether the client supports CompletionList.applyKind to indicate how supported values from completionList.itemDefaults and completion will be combined.

If a client supports applyKind it must support it for all fields that it supports that are listed in CompletionList.applyKind . This means when clients add support for new/future fields in completion items the MUST also support merge for them if those fields are defined in CompletionList.applyKind .

LSP v3.18.0

item_defaults: Sequence[str] | None

The client supports the following itemDefaults on a completion list.

The value lists the supported property names of the CompletionList.itemDefaults object. If omitted no properties are supported.

LSP v3.17.0

class lsprotocol.types.CompletionOptions(trigger_characters=None, all_commit_characters=None, resolve_provider=None, completion_item=None, work_done_progress=None)

Completion options.

Parameters:
all_commit_characters: Sequence[str] | None

The list of all possible characters that commit a completion. This field can be used if clients don’t support individual commit characters per completion item. See ClientCapabilities.textDocument.completion.completionItem.commitCharactersSupport

If a server provides both allCommitCharacters and commit characters on an individual completion item the ones on the completion item win.

LSP v3.2.0

completion_item: ServerCompletionItemOptions | None

The server supports the following CompletionItem specific capabilities.

LSP v3.17.0

resolve_provider: bool | None

The server provides support to resolve additional information for a completion item.

trigger_characters: Sequence[str] | None

Most tools trigger completion request automatically without explicitly requesting it using a keyboard shortcut (e.g. Ctrl+Space). Typically they do so when the user starts to type an identifier. For example if the user types c in a JavaScript file code complete will automatically pop up present console besides others as a completion item. Characters that make up identifiers don’t need to be listed here.

If code complete should automatically be trigger on characters not being valid inside an identifier (for example . in JavaScript) list them in triggerCharacters.

work_done_progress: bool | None
class lsprotocol.types.CompletionParams(text_document, position, context=None, work_done_token=None, partial_result_token=None)

Completion parameters

Parameters:
context: CompletionContext | None

The completion context. This is only available it the client specifies to send this using the client capability textDocument.completion.contextSupport === true

partial_result_token: int | str | None

An optional token that a server can use to report partial results (e.g. streaming) to the client.

position: Position

The position inside the text document.

text_document: TextDocumentIdentifier

The text document.

work_done_token: int | str | None

An optional token that a server can use to report work done progress.

class lsprotocol.types.CompletionRegistrationOptions(document_selector=None, trigger_characters=None, all_commit_characters=None, resolve_provider=None, completion_item=None, work_done_progress=None)

Registration options for a CompletionRequest.

Parameters:
all_commit_characters: Sequence[str] | None

The list of all possible characters that commit a completion. This field can be used if clients don’t support individual commit characters per completion item. See ClientCapabilities.textDocument.completion.completionItem.commitCharactersSupport

If a server provides both allCommitCharacters and commit characters on an individual completion item the ones on the completion item win.

LSP v3.2.0

completion_item: ServerCompletionItemOptions | None

The server supports the following CompletionItem specific capabilities.

LSP v3.17.0

document_selector: Sequence[TextDocumentFilterLanguage | TextDocumentFilterScheme | TextDocumentFilterPattern | NotebookCellTextDocumentFilter] | None

A document selector to identify the scope of the registration. If set to null the document selector provided on the client side will be used.

resolve_provider: bool | None

The server provides support to resolve additional information for a completion item.

trigger_characters: Sequence[str] | None

Most tools trigger completion request automatically without explicitly requesting it using a keyboard shortcut (e.g. Ctrl+Space). Typically they do so when the user starts to type an identifier. For example if the user types c in a JavaScript file code complete will automatically pop up present console besides others as a completion item. Characters that make up identifiers don’t need to be listed here.

If code complete should automatically be trigger on characters not being valid inside an identifier (for example . in JavaScript) list them in triggerCharacters.

work_done_progress: bool | None
class lsprotocol.types.CompletionRequest(id, params, method='textDocument/completion', jsonrpc='2.0')

Request to request completion at a given text document position. The request’s parameter is of type TextDocumentPosition the response is of type CompletionItem CompletionItem[] or {@link CompletionList} or a Thenable that resolves to such.

The request can delay the computation of the {@link CompletionItem.detail detail } and {@link CompletionItem.documentation documentation } properties to the completionItem/resolve request. However, properties that are needed for the initial sorting and filtering, like sortText , filterText , insertText, and textEdit, must not be changed during resolve.

Parameters:
id: int | str

The request id.

jsonrpc: str
method: Literal['textDocument/completion']

The method to be invoked.

params: CompletionParams
class lsprotocol.types.CompletionResolveRequest(id, params, method='completionItem/resolve', jsonrpc='2.0')

Request to resolve additional information for a given completion item.The request’s parameter is of type CompletionItem the response is of type CompletionItem or a Thenable that resolves to such.

Parameters:
id: int | str

The request id.

jsonrpc: str
method: Literal['completionItem/resolve']

The method to be invoked.

params: CompletionItem
class lsprotocol.types.CompletionResolveResponse(id, result=None, jsonrpc='2.0')
Parameters:
id: int | str | None

The request id.

jsonrpc: str
result: CompletionItem
class lsprotocol.types.CompletionResponse(id, result=None, jsonrpc='2.0')
Parameters:
id: int | str | None

The request id.

jsonrpc: str
result: Sequence[CompletionItem] | CompletionList | None
class lsprotocol.types.CompletionTriggerKind(value)

How a completion was triggered

Invoked = 1

Completion was triggered by typing an identifier (24x7 code complete), manual invocation (e.g Ctrl+Space) or via API.

TriggerCharacter = 2

Completion was triggered by a trigger character specified by the triggerCharacters properties of the CompletionRegistrationOptions.

TriggerForIncompleteCompletions = 3

Completion was re-triggered as current completion list is incomplete

class lsprotocol.types.ConfigurationItem(scope_uri=None, section=None)
Parameters:
  • scope_uri (str | None)

  • section (str | None)

scope_uri: str | None

The scope to get the configuration section for.

section: str | None

The configuration section asked for.

class lsprotocol.types.ConfigurationParams(items)

The parameters of a configuration request.

Parameters:

items (Sequence[ConfigurationItem])

items: Sequence[ConfigurationItem]
class lsprotocol.types.ConfigurationRequest(id, params, method='workspace/configuration', jsonrpc='2.0')

The ‘workspace/configuration’ request is sent from the server to the client to fetch a certain configuration setting.

This pull model replaces the old push model were the client signaled configuration change via an event. If the server still needs to react to configuration changes (since the server caches the result of workspace/configuration requests) the server should register for an empty configuration change event and empty the cache if such an event is received.

Parameters:
id: int | str

The request id.

jsonrpc: str
method: Literal['workspace/configuration']

The method to be invoked.

params: ConfigurationParams
class lsprotocol.types.ConfigurationResponse(id, result=None, jsonrpc='2.0')
Parameters:
id: int | str | None

The request id.

jsonrpc: str
result: Sequence[Any | None]
class lsprotocol.types.CreateFile(uri, kind='create', options=None, annotation_id=None)

Create file operation.

Parameters:
annotation_id: str | None

An optional annotation identifier describing the operation.

LSP v3.16.0

kind: str

A create

options: CreateFileOptions | None

Additional options

uri: str

The resource to create.

class lsprotocol.types.CreateFileOptions(overwrite=None, ignore_if_exists=None)

Options to create a file.

Parameters:
  • overwrite (bool | None)

  • ignore_if_exists (bool | None)

ignore_if_exists: bool | None

Ignore if exists.

overwrite: bool | None

Overwrite existing file. Overwrite wins over ignoreIfExists

class lsprotocol.types.CreateFilesParams(files)

The parameters sent in notifications/requests for user-initiated creation of files.

LSP v3.16.0

Parameters:

files (Sequence[FileCreate])

files: Sequence[FileCreate]

An array of all files/folders created in this operation.

class lsprotocol.types.DeclarationClientCapabilities(dynamic_registration=None, link_support=None)

LSP v3.14.0

Parameters:
  • dynamic_registration (bool | None)

  • link_support (bool | None)

dynamic_registration: bool | None

Whether declaration supports dynamic registration. If this is set to true the client supports the new DeclarationRegistrationOptions return value for the corresponding server capability as well.

The client supports additional metadata in the form of declaration links.

class lsprotocol.types.DeclarationOptions(work_done_progress=None)
Parameters:

work_done_progress (bool | None)

work_done_progress: bool | None
class lsprotocol.types.DeclarationParams(text_document, position, work_done_token=None, partial_result_token=None)
Parameters:
partial_result_token: int | str | None

An optional token that a server can use to report partial results (e.g. streaming) to the client.

position: Position

The position inside the text document.

text_document: TextDocumentIdentifier

The text document.

work_done_token: int | str | None

An optional token that a server can use to report work done progress.

class lsprotocol.types.DeclarationRegistrationOptions(work_done_progress=None, document_selector=None, id=None)
Parameters:
document_selector: Sequence[TextDocumentFilterLanguage | TextDocumentFilterScheme | TextDocumentFilterPattern | NotebookCellTextDocumentFilter] | None

A document selector to identify the scope of the registration. If set to null the document selector provided on the client side will be used.

id: str | None

The id used to register the request. The id can be used to deregister the request again. See also Registration#id.

work_done_progress: bool | None
class lsprotocol.types.DeclarationRequest(id, params, method='textDocument/declaration', jsonrpc='2.0')

A request to resolve the type definition locations of a symbol at a given text document position. The request’s parameter is of type TextDocumentPositionParams the response is of type Declaration or a typed array of {@link DeclarationLink} or a Thenable that resolves to such.

Parameters:
id: int | str

The request id.

jsonrpc: str
method: Literal['textDocument/declaration']

The method to be invoked.

params: DeclarationParams
class lsprotocol.types.DeclarationResponse(id, result=None, jsonrpc='2.0')
Parameters:
id: int | str | None

The request id.

jsonrpc: str
result: Location | Sequence[Location] | Sequence[LocationLink] | None
class lsprotocol.types.DefinitionClientCapabilities(dynamic_registration=None, link_support=None)

Client Capabilities for a DefinitionRequest.

Parameters:
  • dynamic_registration (bool | None)

  • link_support (bool | None)

dynamic_registration: bool | None

Whether definition supports dynamic registration.

The client supports additional metadata in the form of definition links.

LSP v3.14.0

class lsprotocol.types.DefinitionOptions(work_done_progress=None)

Server Capabilities for a DefinitionRequest.

Parameters:

work_done_progress (bool | None)

work_done_progress: bool | None
class lsprotocol.types.DefinitionParams(text_document, position, work_done_token=None, partial_result_token=None)

Parameters for a DefinitionRequest.

Parameters:
partial_result_token: int | str | None

An optional token that a server can use to report partial results (e.g. streaming) to the client.

position: Position

The position inside the text document.

text_document: TextDocumentIdentifier

The text document.

work_done_token: int | str | None

An optional token that a server can use to report work done progress.

class lsprotocol.types.DefinitionRegistrationOptions(document_selector=None, work_done_progress=None)

Registration options for a DefinitionRequest.

Parameters:
document_selector: Sequence[TextDocumentFilterLanguage | TextDocumentFilterScheme | TextDocumentFilterPattern | NotebookCellTextDocumentFilter] | None

A document selector to identify the scope of the registration. If set to null the document selector provided on the client side will be used.

work_done_progress: bool | None
class lsprotocol.types.DefinitionRequest(id, params, method='textDocument/definition', jsonrpc='2.0')

A request to resolve the definition location of a symbol at a given text document position. The request’s parameter is of type TextDocumentPosition the response is of either type Definition or a typed array of DefinitionLink or a Thenable that resolves to such.

Parameters:
id: int | str

The request id.

jsonrpc: str
method: Literal['textDocument/definition']

The method to be invoked.

params: DefinitionParams
class lsprotocol.types.DefinitionResponse(id, result=None, jsonrpc='2.0')
Parameters:
id: int | str | None

The request id.

jsonrpc: str
result: Location | Sequence[Location] | Sequence[LocationLink] | None
class lsprotocol.types.DeleteFile(uri, kind='delete', options=None, annotation_id=None)

Delete file operation

Parameters:
annotation_id: str | None

An optional annotation identifier describing the operation.

LSP v3.16.0

kind: str

A delete

options: DeleteFileOptions | None

Delete options.

uri: str

The file to delete.

class lsprotocol.types.DeleteFileOptions(recursive=None, ignore_if_not_exists=None)

Delete file options

Parameters:
  • recursive (bool | None)

  • ignore_if_not_exists (bool | None)

ignore_if_not_exists: bool | None

Ignore the operation if the file doesn’t exist.

recursive: bool | None

Delete the content recursively if a folder is denoted.

class lsprotocol.types.DeleteFilesParams(files)

The parameters sent in notifications/requests for user-initiated deletes of files.

LSP v3.16.0

Parameters:

files (Sequence[FileDelete])

files: Sequence[FileDelete]

An array of all files/folders deleted in this operation.

class lsprotocol.types.Diagnostic(range, message, severity=None, code=None, code_description=None, source=None, tags=None, related_information=None, data=None)

Represents a diagnostic, such as a compiler error or warning. Diagnostic objects are only valid in the scope of a resource.

Parameters:
code: int | str | None

The diagnostic’s code, which usually appear in the user interface.

code_description: CodeDescription | None

An optional property to describe the error code. Requires the code field (above) to be present/not null.

LSP v3.16.0

data: Any | None

A data entry field that is preserved between a textDocument/publishDiagnostics notification and textDocument/codeAction request.

LSP v3.16.0

message: str

The diagnostic’s message. It usually appears in the user interface

range: Range

The range at which the message applies

related_information: Sequence[DiagnosticRelatedInformation] | None

An array of related diagnostic information, e.g. when symbol-names within a scope collide all definitions can be marked via this property.

severity: DiagnosticSeverity | None

The diagnostic’s severity. To avoid interpretation mismatches when a server is used with different clients it is highly recommended that servers always provide a severity value.

source: str | None

A human-readable string describing the source of this diagnostic, e.g. ‘typescript’ or ‘super lint’. It usually appears in the user interface.

tags: Sequence[DiagnosticTag] | None

Additional metadata about the diagnostic.

LSP v3.15.0

class lsprotocol.types.DiagnosticClientCapabilities(dynamic_registration=None, related_document_support=None, related_information=None, tag_support=None, code_description_support=None, data_support=None)

Client capabilities specific to diagnostic pull requests.

LSP v3.17.0

Parameters:
code_description_support: bool | None

Client supports a codeDescription property

LSP v3.16.0

data_support: bool | None

Whether code action supports the data property which is preserved between a textDocument/publishDiagnostics and textDocument/codeAction request.

LSP v3.16.0

dynamic_registration: bool | None

Whether implementation supports dynamic registration. If this is set to true the client supports the new (TextDocumentRegistrationOptions & StaticRegistrationOptions) return value for the corresponding server capability as well.

related_document_support: bool | None

Whether the clients supports related documents for document diagnostic pulls.

related_information: bool | None

Whether the clients accepts diagnostics with related information.

tag_support: ClientDiagnosticsTagOptions | None

Client supports the tag property to provide meta data about a diagnostic. Clients supporting tags have to handle unknown tags gracefully.

LSP v3.15.0

class lsprotocol.types.DiagnosticOptions(inter_file_dependencies, workspace_diagnostics, identifier=None, work_done_progress=None)

Diagnostic options.

LSP v3.17.0

Parameters:
  • inter_file_dependencies (bool)

  • workspace_diagnostics (bool)

  • identifier (str | None)

  • work_done_progress (bool | None)

identifier: str | None

An optional identifier under which the diagnostics are managed by the client.

inter_file_dependencies: bool

Whether the language has inter file dependencies meaning that editing code in one file can result in a different diagnostic set in another file. Inter file dependencies are common for most programming languages and typically uncommon for linters.

work_done_progress: bool | None
workspace_diagnostics: bool

The server provides support for workspace diagnostics as well.

class lsprotocol.types.DiagnosticRefreshRequest(id, params=None, method='workspace/diagnostic/refresh', jsonrpc='2.0')

The diagnostic refresh request definition.

LSP v3.17.0

Parameters:
  • id (int | str)

  • params (None)

  • method (Literal['workspace/diagnostic/refresh'])

  • jsonrpc (str)

id: int | str

The request id.

jsonrpc: str
method: Literal['workspace/diagnostic/refresh']

The method to be invoked.

params: None
class lsprotocol.types.DiagnosticRefreshResponse(id, result=None, jsonrpc='2.0')
Parameters:
  • id (int | str | None)

  • result (None)

  • jsonrpc (str)

id: int | str | None

The request id.

jsonrpc: str
result: None
class lsprotocol.types.DiagnosticRegistrationOptions(inter_file_dependencies, workspace_diagnostics, document_selector=None, identifier=None, work_done_progress=None, id=None)

Diagnostic registration options.

LSP v3.17.0

Parameters:
document_selector: Sequence[TextDocumentFilterLanguage | TextDocumentFilterScheme | TextDocumentFilterPattern | NotebookCellTextDocumentFilter] | None

A document selector to identify the scope of the registration. If set to null the document selector provided on the client side will be used.

id: str | None

The id used to register the request. The id can be used to deregister the request again. See also Registration#id.

identifier: str | None

An optional identifier under which the diagnostics are managed by the client.

inter_file_dependencies: bool

Whether the language has inter file dependencies meaning that editing code in one file can result in a different diagnostic set in another file. Inter file dependencies are common for most programming languages and typically uncommon for linters.

work_done_progress: bool | None
workspace_diagnostics: bool

The server provides support for workspace diagnostics as well.

class lsprotocol.types.DiagnosticRelatedInformation(location, message)

Represents a related message and source code location for a diagnostic. This should be used to point to code locations that cause or related to a diagnostics, e.g when duplicating a symbol in a scope.

Parameters:
location: Location

The location of this related diagnostic information.

message: str

The message of this related diagnostic information.

class lsprotocol.types.DiagnosticServerCancellationData(retrigger_request)

Cancellation data returned from a diagnostic request.

LSP v3.17.0

Parameters:

retrigger_request (bool)

retrigger_request: bool
class lsprotocol.types.DiagnosticSeverity(value)

The diagnostic’s severity.

Error = 1

Reports an error.

Hint = 4

Reports a hint.

Information = 3

Reports an information.

Warning = 2

Reports a warning.

class lsprotocol.types.DiagnosticTag(value)

The diagnostic tags.

LSP v3.15.0

Deprecated = 2

Deprecated or obsolete code.

Clients are allowed to rendered diagnostics with this tag strike through.

Unnecessary = 1

Unused or unnecessary code.

Clients are allowed to render diagnostics with this tag faded out instead of having an error squiggle.

class lsprotocol.types.DiagnosticWorkspaceClientCapabilities(refresh_support=None)

Workspace client capabilities specific to diagnostic pull requests.

LSP v3.17.0

Parameters:

refresh_support (bool | None)

refresh_support: bool | None

Whether the client implementation supports a refresh request sent from the server to the client.

Note that this event is global and will force the client to refresh all pulled diagnostics currently shown. It should be used with absolute care and is useful for situation where a server for example detects a project wide change that requires such a calculation.

class lsprotocol.types.DiagnosticsCapabilities(related_information=None, tag_support=None, code_description_support=None, data_support=None)

General diagnostics capabilities for pull and push model.

Parameters:
code_description_support: bool | None

Client supports a codeDescription property

LSP v3.16.0

data_support: bool | None

Whether code action supports the data property which is preserved between a textDocument/publishDiagnostics and textDocument/codeAction request.

LSP v3.16.0

related_information: bool | None

Whether the clients accepts diagnostics with related information.

tag_support: ClientDiagnosticsTagOptions | None

Client supports the tag property to provide meta data about a diagnostic. Clients supporting tags have to handle unknown tags gracefully.

LSP v3.15.0

class lsprotocol.types.DidChangeConfigurationClientCapabilities(dynamic_registration=None)
Parameters:

dynamic_registration (bool | None)

dynamic_registration: bool | None

Did change configuration notification supports dynamic registration.

class lsprotocol.types.DidChangeConfigurationNotification(params, method='workspace/didChangeConfiguration', jsonrpc='2.0')

The configuration change notification is sent from the client to the server when the client’s configuration has changed. The notification contains the changed configuration as defined by the language client.

Parameters:
jsonrpc: str
method: Literal['workspace/didChangeConfiguration']

The method to be invoked.

params: DidChangeConfigurationParams
class lsprotocol.types.DidChangeConfigurationParams(settings)

The parameters of a change configuration notification.

Parameters:

settings (Any | None)

settings: Any | None

The actual changed settings

class lsprotocol.types.DidChangeConfigurationRegistrationOptions(section=None)
Parameters:

section (str | Sequence[str] | None)

section: str | Sequence[str] | None
class lsprotocol.types.DidChangeNotebookDocumentNotification(params, method='notebookDocument/didChange', jsonrpc='2.0')
Parameters:
jsonrpc: str
method: Literal['notebookDocument/didChange']

The method to be invoked.

params: DidChangeNotebookDocumentParams
class lsprotocol.types.DidChangeNotebookDocumentParams(notebook_document, change)

The params sent in a change notebook document notification.

LSP v3.17.0

Parameters:
change: NotebookDocumentChangeEvent

The actual changes to the notebook document.

The changes describe single state changes to the notebook document. So if there are two changes c1 (at array index 0) and c2 (at array index 1) for a notebook in state S then c1 moves the notebook from S to S’ and c2 from S’ to S’’. So c1 is computed on the state S and c2 is computed on the state S’.

To mirror the content of a notebook using change events use the following approach:

  • start with the same initial content

  • apply the ‘notebookDocument/didChange’ notifications in the order you receive them.

  • apply the NotebookChangeEvent s in a single notification in the order you receive them.

notebook_document: VersionedNotebookDocumentIdentifier

The notebook document that did change. The version number points to the version after all provided changes have been applied. If only the text document content of a cell changes the notebook version doesn’t necessarily have to change.

class lsprotocol.types.DidChangeTextDocumentNotification(params, method='textDocument/didChange', jsonrpc='2.0')

The document change notification is sent from the client to the server to signal changes to a text document.

Parameters:
jsonrpc: str
method: Literal['textDocument/didChange']

The method to be invoked.

params: DidChangeTextDocumentParams
class lsprotocol.types.DidChangeTextDocumentParams(text_document, content_changes)

The change text document notification’s parameters.

Parameters:
content_changes: Sequence[TextDocumentContentChangePartial | TextDocumentContentChangeWholeDocument]

The actual content changes. The content changes describe single state changes to the document. So if there are two content changes c1 (at array index 0) and c2 (at array index 1) for a document in state S then c1 moves the document from S to S’ and c2 from S’ to S’’. So c1 is computed on the state S and c2 is computed on the state S’.

To mirror the content of a document using change events use the following approach:

  • start with the same initial content

  • apply the ‘textDocument/didChange’ notifications in the order you receive them.

  • apply the TextDocumentContentChangeEvent s in a single notification in the order you receive them.

text_document: VersionedTextDocumentIdentifier

The document that did change. The version number points to the version after all provided content changes have been applied.

class lsprotocol.types.DidChangeWatchedFilesClientCapabilities(dynamic_registration=None, relative_pattern_support=None)
Parameters:
  • dynamic_registration (bool | None)

  • relative_pattern_support (bool | None)

dynamic_registration: bool | None

Did change watched files notification supports dynamic registration. Please note that the current protocol doesn’t support static configuration for file changes from the server side.

relative_pattern_support: bool | None

Whether the client has support for RelativePattern relative pattern or not.

LSP v3.17.0

class lsprotocol.types.DidChangeWatchedFilesNotification(params, method='workspace/didChangeWatchedFiles', jsonrpc='2.0')

The watched files notification is sent from the client to the server when the client detects changes to file watched by the language client.

Parameters:
jsonrpc: str
method: Literal['workspace/didChangeWatchedFiles']

The method to be invoked.

params: DidChangeWatchedFilesParams
class lsprotocol.types.DidChangeWatchedFilesParams(changes)

The watched files change notification’s parameters.

Parameters:

changes (Sequence[FileEvent])

changes: Sequence[FileEvent]

The actual file events.

class lsprotocol.types.DidChangeWatchedFilesRegistrationOptions(watchers)

Describe options to be used when registered for text document change events.

Parameters:

watchers (Sequence[FileSystemWatcher])

watchers: Sequence[FileSystemWatcher]

The watchers to register.

class lsprotocol.types.DidChangeWorkspaceFoldersNotification(params, method='workspace/didChangeWorkspaceFolders', jsonrpc='2.0')

The workspace/didChangeWorkspaceFolders notification is sent from the client to the server when the workspace folder configuration changes.

Parameters:
jsonrpc: str
method: Literal['workspace/didChangeWorkspaceFolders']

The method to be invoked.

params: DidChangeWorkspaceFoldersParams
class lsprotocol.types.DidChangeWorkspaceFoldersParams(event)

The parameters of a workspace/didChangeWorkspaceFolders notification.

Parameters:

event (WorkspaceFoldersChangeEvent)

event: WorkspaceFoldersChangeEvent

The actual workspace folder change event.

class lsprotocol.types.DidCloseNotebookDocumentNotification(params, method='notebookDocument/didClose', jsonrpc='2.0')

A notification sent when a notebook closes.

LSP v3.17.0

Parameters:
jsonrpc: str
method: Literal['notebookDocument/didClose']

The method to be invoked.

params: DidCloseNotebookDocumentParams
class lsprotocol.types.DidCloseNotebookDocumentParams(notebook_document, cell_text_documents)

The params sent in a close notebook document notification.

LSP v3.17.0

Parameters:
cell_text_documents: Sequence[TextDocumentIdentifier]

The text documents that represent the content of a notebook cell that got closed.

notebook_document: NotebookDocumentIdentifier

The notebook document that got closed.

class lsprotocol.types.DidCloseTextDocumentNotification(params, method='textDocument/didClose', jsonrpc='2.0')

The document close notification is sent from the client to the server when the document got closed in the client. The document’s truth now exists where the document’s uri points to (e.g. if the document’s uri is a file uri the truth now exists on disk). As with the open notification the close notification is about managing the document’s content. Receiving a close notification doesn’t mean that the document was open in an editor before. A close notification requires a previous open notification to be sent.

Parameters:
jsonrpc: str
method: Literal['textDocument/didClose']

The method to be invoked.

params: DidCloseTextDocumentParams
class lsprotocol.types.DidCloseTextDocumentParams(text_document)

The parameters sent in a close text document notification

Parameters:

text_document (TextDocumentIdentifier)

text_document: TextDocumentIdentifier

The document that was closed.

class lsprotocol.types.DidCreateFilesNotification(params, method='workspace/didCreateFiles', jsonrpc='2.0')

The did create files notification is sent from the client to the server when files were created from within the client.

LSP v3.16.0

Parameters:
jsonrpc: str
method: Literal['workspace/didCreateFiles']

The method to be invoked.

params: CreateFilesParams
class lsprotocol.types.DidDeleteFilesNotification(params, method='workspace/didDeleteFiles', jsonrpc='2.0')

The will delete files request is sent from the client to the server before files are actually deleted as long as the deletion is triggered from within the client.

LSP v3.16.0

Parameters:
jsonrpc: str
method: Literal['workspace/didDeleteFiles']

The method to be invoked.

params: DeleteFilesParams
class lsprotocol.types.DidOpenNotebookDocumentNotification(params, method='notebookDocument/didOpen', jsonrpc='2.0')

A notification sent when a notebook opens.

LSP v3.17.0

Parameters:
jsonrpc: str
method: Literal['notebookDocument/didOpen']

The method to be invoked.

params: DidOpenNotebookDocumentParams
class lsprotocol.types.DidOpenNotebookDocumentParams(notebook_document, cell_text_documents)

The params sent in an open notebook document notification.

LSP v3.17.0

Parameters:
cell_text_documents: Sequence[TextDocumentItem]

The text documents that represent the content of a notebook cell.

notebook_document: NotebookDocument

The notebook document that got opened.

class lsprotocol.types.DidOpenTextDocumentNotification(params, method='textDocument/didOpen', jsonrpc='2.0')

The document open notification is sent from the client to the server to signal newly opened text documents. The document’s truth is now managed by the client and the server must not try to read the document’s truth using the document’s uri. Open in this sense means it is managed by the client. It doesn’t necessarily mean that its content is presented in an editor. An open notification must not be sent more than once without a corresponding close notification send before. This means open and close notification must be balanced and the max open count is one.

Parameters:
jsonrpc: str
method: Literal['textDocument/didOpen']

The method to be invoked.

params: DidOpenTextDocumentParams
class lsprotocol.types.DidOpenTextDocumentParams(text_document)

The parameters sent in an open text document notification

Parameters:

text_document (TextDocumentItem)

text_document: TextDocumentItem

The document that was opened.

class lsprotocol.types.DidRenameFilesNotification(params, method='workspace/didRenameFiles', jsonrpc='2.0')

The did rename files notification is sent from the client to the server when files were renamed from within the client.

LSP v3.16.0

Parameters:
jsonrpc: str
method: Literal['workspace/didRenameFiles']

The method to be invoked.

params: RenameFilesParams
class lsprotocol.types.DidSaveNotebookDocumentNotification(params, method='notebookDocument/didSave', jsonrpc='2.0')

A notification sent when a notebook document is saved.

LSP v3.17.0

Parameters:
jsonrpc: str
method: Literal['notebookDocument/didSave']

The method to be invoked.

params: DidSaveNotebookDocumentParams
class lsprotocol.types.DidSaveNotebookDocumentParams(notebook_document)

The params sent in a save notebook document notification.

LSP v3.17.0

Parameters:

notebook_document (NotebookDocumentIdentifier)

notebook_document: NotebookDocumentIdentifier

The notebook document that got saved.

class lsprotocol.types.DidSaveTextDocumentNotification(params, method='textDocument/didSave', jsonrpc='2.0')

The document save notification is sent from the client to the server when the document got saved in the client.

Parameters:
jsonrpc: str
method: Literal['textDocument/didSave']

The method to be invoked.

params: DidSaveTextDocumentParams
class lsprotocol.types.DidSaveTextDocumentParams(text_document, text=None)

The parameters sent in a save text document notification

Parameters:
text: str | None

Optional the content when saved. Depends on the includeText value when the save notification was requested.

text_document: TextDocumentIdentifier

The document that was saved.

class lsprotocol.types.DocumentColorClientCapabilities(dynamic_registration=None)
Parameters:

dynamic_registration (bool | None)

dynamic_registration: bool | None

Whether implementation supports dynamic registration. If this is set to true the client supports the new DocumentColorRegistrationOptions return value for the corresponding server capability as well.

class lsprotocol.types.DocumentColorOptions(work_done_progress=None)
Parameters:

work_done_progress (bool | None)

work_done_progress: bool | None
class lsprotocol.types.DocumentColorParams(text_document, work_done_token=None, partial_result_token=None)

Parameters for a DocumentColorRequest.

Parameters:
partial_result_token: int | str | None

An optional token that a server can use to report partial results (e.g. streaming) to the client.

text_document: TextDocumentIdentifier

The text document.

work_done_token: int | str | None

An optional token that a server can use to report work done progress.

class lsprotocol.types.DocumentColorRegistrationOptions(document_selector=None, work_done_progress=None, id=None)
Parameters:
document_selector: Sequence[TextDocumentFilterLanguage | TextDocumentFilterScheme | TextDocumentFilterPattern | NotebookCellTextDocumentFilter] | None

A document selector to identify the scope of the registration. If set to null the document selector provided on the client side will be used.

id: str | None

The id used to register the request. The id can be used to deregister the request again. See also Registration#id.

work_done_progress: bool | None
class lsprotocol.types.DocumentColorRequest(id, params, method='textDocument/documentColor', jsonrpc='2.0')

A request to list all color symbols found in a given text document. The request’s parameter is of type DocumentColorParams the response is of type ColorInformation ColorInformation[] or a Thenable that resolves to such.

Parameters:
id: int | str

The request id.

jsonrpc: str
method: Literal['textDocument/documentColor']

The method to be invoked.

params: DocumentColorParams
class lsprotocol.types.DocumentColorResponse(id, result=None, jsonrpc='2.0')
Parameters:
id: int | str | None

The request id.

jsonrpc: str
result: Sequence[ColorInformation]
class lsprotocol.types.DocumentDiagnosticParams(text_document, identifier=None, previous_result_id=None, work_done_token=None, partial_result_token=None)

Parameters of the document diagnostic request.

LSP v3.17.0

Parameters:
identifier: str | None

The additional identifier provided during registration.

partial_result_token: int | str | None

An optional token that a server can use to report partial results (e.g. streaming) to the client.

previous_result_id: str | None

The result id of a previous response if provided.

text_document: TextDocumentIdentifier

The text document.

work_done_token: int | str | None

An optional token that a server can use to report work done progress.

class lsprotocol.types.DocumentDiagnosticReportKind(value)

The document diagnostic report kinds.

LSP v3.17.0

Full = 'full'

A diagnostic report with a full set of problems.

Unchanged = 'unchanged'

A report indicating that the last returned report is still accurate.

class lsprotocol.types.DocumentDiagnosticReportPartialResult(related_documents)

A partial result for a document diagnostic report.

LSP v3.17.0

Parameters:

related_documents (Mapping[str, FullDocumentDiagnosticReport | UnchangedDocumentDiagnosticReport])

related_documents: Mapping[str, FullDocumentDiagnosticReport | UnchangedDocumentDiagnosticReport]
class lsprotocol.types.DocumentDiagnosticRequest(id, params, method='textDocument/diagnostic', jsonrpc='2.0')

The document diagnostic request definition.

LSP v3.17.0

Parameters:
id: int | str

The request id.

jsonrpc: str
method: Literal['textDocument/diagnostic']

The method to be invoked.

params: DocumentDiagnosticParams
class lsprotocol.types.DocumentDiagnosticResponse(id, result=None, jsonrpc='2.0')
Parameters:
id: int | str | None

The request id.

jsonrpc: str
result: RelatedFullDocumentDiagnosticReport | RelatedUnchangedDocumentDiagnosticReport
class lsprotocol.types.DocumentFormattingClientCapabilities(dynamic_registration=None)

Client capabilities of a DocumentFormattingRequest.

Parameters:

dynamic_registration (bool | None)

dynamic_registration: bool | None

Whether formatting supports dynamic registration.

class lsprotocol.types.DocumentFormattingOptions(work_done_progress=None)

Provider options for a DocumentFormattingRequest.

Parameters:

work_done_progress (bool | None)

work_done_progress: bool | None
class lsprotocol.types.DocumentFormattingParams(text_document, options, work_done_token=None)

The parameters of a DocumentFormattingRequest.

Parameters:
options: FormattingOptions

The format options.

text_document: TextDocumentIdentifier

The document to format.

work_done_token: int | str | None

An optional token that a server can use to report work done progress.

class lsprotocol.types.DocumentFormattingRegistrationOptions(document_selector=None, work_done_progress=None)

Registration options for a DocumentFormattingRequest.

Parameters:
document_selector: Sequence[TextDocumentFilterLanguage | TextDocumentFilterScheme | TextDocumentFilterPattern | NotebookCellTextDocumentFilter] | None

A document selector to identify the scope of the registration. If set to null the document selector provided on the client side will be used.

work_done_progress: bool | None
class lsprotocol.types.DocumentFormattingRequest(id, params, method='textDocument/formatting', jsonrpc='2.0')

A request to format a whole document.

Parameters:
id: int | str

The request id.

jsonrpc: str
method: Literal['textDocument/formatting']

The method to be invoked.

params: DocumentFormattingParams
class lsprotocol.types.DocumentFormattingResponse(id, result=None, jsonrpc='2.0')
Parameters:
id: int | str | None

The request id.

jsonrpc: str
result: Sequence[TextEdit] | None
class lsprotocol.types.DocumentHighlight(range, kind=None)

A document highlight is a range inside a text document which deserves special attention. Usually a document highlight is visualized by changing the background color of its range.

Parameters:
kind: DocumentHighlightKind | None

The highlight kind, default is Text text.

range: Range

The range this highlight applies to.

class lsprotocol.types.DocumentHighlightClientCapabilities(dynamic_registration=None)

Client Capabilities for a DocumentHighlightRequest.

Parameters:

dynamic_registration (bool | None)

dynamic_registration: bool | None

Whether document highlight supports dynamic registration.

class lsprotocol.types.DocumentHighlightKind(value)

A document highlight kind.

Read = 2

Read-access of a symbol, like reading a variable.

Text = 1

A textual occurrence.

Write = 3

Write-access of a symbol, like writing to a variable.

class lsprotocol.types.DocumentHighlightOptions(work_done_progress=None)

Provider options for a DocumentHighlightRequest.

Parameters:

work_done_progress (bool | None)

work_done_progress: bool | None
class lsprotocol.types.DocumentHighlightParams(text_document, position, work_done_token=None, partial_result_token=None)

Parameters for a DocumentHighlightRequest.

Parameters:
partial_result_token: int | str | None

An optional token that a server can use to report partial results (e.g. streaming) to the client.

position: Position

The position inside the text document.

text_document: TextDocumentIdentifier

The text document.

work_done_token: int | str | None

An optional token that a server can use to report work done progress.

class lsprotocol.types.DocumentHighlightRegistrationOptions(document_selector=None, work_done_progress=None)

Registration options for a DocumentHighlightRequest.

Parameters:
document_selector: Sequence[TextDocumentFilterLanguage | TextDocumentFilterScheme | TextDocumentFilterPattern | NotebookCellTextDocumentFilter] | None

A document selector to identify the scope of the registration. If set to null the document selector provided on the client side will be used.

work_done_progress: bool | None
class lsprotocol.types.DocumentHighlightRequest(id, params, method='textDocument/documentHighlight', jsonrpc='2.0')

Request to resolve a DocumentHighlight for a given text document position. The request’s parameter is of type TextDocumentPosition the request response is an array of type DocumentHighlight or a Thenable that resolves to such.

Parameters:
id: int | str

The request id.

jsonrpc: str
method: Literal['textDocument/documentHighlight']

The method to be invoked.

params: DocumentHighlightParams
class lsprotocol.types.DocumentHighlightResponse(id, result=None, jsonrpc='2.0')
Parameters:
id: int | str | None

The request id.

jsonrpc: str
result: Sequence[DocumentHighlight] | None

A document link is a range in a text document that links to an internal or external resource, like another text document or a web site.

Parameters:
  • range (Range)

  • target (str | None)

  • tooltip (str | None)

  • data (Any | None)

data: Any | None

A data entry field that is preserved on a document link between a DocumentLinkRequest and a DocumentLinkResolveRequest.

range: Range

The range this link applies to.

target: str | None

The uri this link points to. If missing a resolve request is sent later.

tooltip: str | None

The tooltip text when you hover over this link.

If a tooltip is provided, is will be displayed in a string that includes instructions on how to trigger the link, such as {0} (ctrl + click) . The specific instructions vary depending on OS, user settings, and localization.

LSP v3.15.0

class lsprotocol.types.DocumentLinkClientCapabilities(dynamic_registration=None, tooltip_support=None)

The client capabilities of a DocumentLinkRequest.

Parameters:
  • dynamic_registration (bool | None)

  • tooltip_support (bool | None)

dynamic_registration: bool | None

Whether document link supports dynamic registration.

tooltip_support: bool | None

Whether the client supports the tooltip property on DocumentLink.

LSP v3.15.0

class lsprotocol.types.DocumentLinkOptions(resolve_provider=None, work_done_progress=None)

Provider options for a DocumentLinkRequest.

Parameters:
  • resolve_provider (bool | None)

  • work_done_progress (bool | None)

resolve_provider: bool | None

Document links have a resolve provider as well.

work_done_progress: bool | None
class lsprotocol.types.DocumentLinkParams(text_document, work_done_token=None, partial_result_token=None)

The parameters of a DocumentLinkRequest.

Parameters:
partial_result_token: int | str | None

An optional token that a server can use to report partial results (e.g. streaming) to the client.

text_document: TextDocumentIdentifier

The document to provide document links for.

work_done_token: int | str | None

An optional token that a server can use to report work done progress.

class lsprotocol.types.DocumentLinkRegistrationOptions(document_selector=None, resolve_provider=None, work_done_progress=None)

Registration options for a DocumentLinkRequest.

Parameters:
document_selector: Sequence[TextDocumentFilterLanguage | TextDocumentFilterScheme | TextDocumentFilterPattern | NotebookCellTextDocumentFilter] | None

A document selector to identify the scope of the registration. If set to null the document selector provided on the client side will be used.

resolve_provider: bool | None

Document links have a resolve provider as well.

work_done_progress: bool | None
class lsprotocol.types.DocumentLinkRequest(id, params, method='textDocument/documentLink', jsonrpc='2.0')

A request to provide document links

Parameters:
id: int | str

The request id.

jsonrpc: str
method: Literal['textDocument/documentLink']

The method to be invoked.

params: DocumentLinkParams
class lsprotocol.types.DocumentLinkResolveRequest(id, params, method='documentLink/resolve', jsonrpc='2.0')

Request to resolve additional information for a given document link. The request’s parameter is of type DocumentLink the response is of type DocumentLink or a Thenable that resolves to such.

Parameters:
id: int | str

The request id.

jsonrpc: str
method: Literal['documentLink/resolve']

The method to be invoked.

params: DocumentLink
class lsprotocol.types.DocumentLinkResolveResponse(id, result=None, jsonrpc='2.0')
Parameters:
id: int | str | None

The request id.

jsonrpc: str
result: DocumentLink
class lsprotocol.types.DocumentLinkResponse(id, result=None, jsonrpc='2.0')
Parameters:
id: int | str | None

The request id.

jsonrpc: str
result: Sequence[DocumentLink] | None
class lsprotocol.types.DocumentOnTypeFormattingClientCapabilities(dynamic_registration=None)

Client capabilities of a DocumentOnTypeFormattingRequest.

Parameters:

dynamic_registration (bool | None)

dynamic_registration: bool | None

Whether on type formatting supports dynamic registration.

class lsprotocol.types.DocumentOnTypeFormattingOptions(first_trigger_character, more_trigger_character=None)

Provider options for a DocumentOnTypeFormattingRequest.

Parameters:
  • first_trigger_character (str)

  • more_trigger_character (Sequence[str] | None)

first_trigger_character: str

A character on which formatting should be triggered, like { .

more_trigger_character: Sequence[str] | None

More trigger characters.

class lsprotocol.types.DocumentOnTypeFormattingParams(text_document, position, ch, options)

The parameters of a DocumentOnTypeFormattingRequest.

Parameters:
ch: str

The character that has been typed that triggered the formatting on type request. That is not necessarily the last character that got inserted into the document since the client could auto insert characters as well (e.g. like automatic brace completion).

options: FormattingOptions

The formatting options.

position: Position

The position around which the on type formatting should happen. This is not necessarily the exact position where the character denoted by the property ch got typed.

text_document: TextDocumentIdentifier

The document to format.

class lsprotocol.types.DocumentOnTypeFormattingRegistrationOptions(first_trigger_character, document_selector=None, more_trigger_character=None)

Registration options for a DocumentOnTypeFormattingRequest.

Parameters:
document_selector: Sequence[TextDocumentFilterLanguage | TextDocumentFilterScheme | TextDocumentFilterPattern | NotebookCellTextDocumentFilter] | None

A document selector to identify the scope of the registration. If set to null the document selector provided on the client side will be used.

first_trigger_character: str

A character on which formatting should be triggered, like { .

more_trigger_character: Sequence[str] | None

More trigger characters.

class lsprotocol.types.DocumentOnTypeFormattingRequest(id, params, method='textDocument/onTypeFormatting', jsonrpc='2.0')

A request to format a document on type.

Parameters:
id: int | str

The request id.

jsonrpc: str
method: Literal['textDocument/onTypeFormatting']

The method to be invoked.

params: DocumentOnTypeFormattingParams
class lsprotocol.types.DocumentOnTypeFormattingResponse(id, result=None, jsonrpc='2.0')
Parameters:
id: int | str | None

The request id.

jsonrpc: str
result: Sequence[TextEdit] | None
class lsprotocol.types.DocumentRangeFormattingClientCapabilities(dynamic_registration=None, ranges_support=None)

Client capabilities of a DocumentRangeFormattingRequest.

Parameters:
  • dynamic_registration (bool | None)

  • ranges_support (bool | None)

dynamic_registration: bool | None

Whether range formatting supports dynamic registration.

ranges_support: bool | None

Whether the client supports formatting multiple ranges at once.

LSP v3.18.0 @proposed

class lsprotocol.types.DocumentRangeFormattingOptions(ranges_support=None, work_done_progress=None)

Provider options for a DocumentRangeFormattingRequest.

Parameters:
  • ranges_support (bool | None)

  • work_done_progress (bool | None)

ranges_support: bool | None

Whether the server supports formatting multiple ranges at once.

LSP v3.18.0 @proposed

work_done_progress: bool | None
class lsprotocol.types.DocumentRangeFormattingParams(text_document, range, options, work_done_token=None)

The parameters of a DocumentRangeFormattingRequest.

Parameters:
options: FormattingOptions

The format options

range: Range

The range to format

text_document: TextDocumentIdentifier

The document to format.

work_done_token: int | str | None

An optional token that a server can use to report work done progress.

class lsprotocol.types.DocumentRangeFormattingRegistrationOptions(document_selector=None, ranges_support=None, work_done_progress=None)

Registration options for a DocumentRangeFormattingRequest.

Parameters:
document_selector: Sequence[TextDocumentFilterLanguage | TextDocumentFilterScheme | TextDocumentFilterPattern | NotebookCellTextDocumentFilter] | None

A document selector to identify the scope of the registration. If set to null the document selector provided on the client side will be used.

ranges_support: bool | None

Whether the server supports formatting multiple ranges at once.

LSP v3.18.0 @proposed

work_done_progress: bool | None
class lsprotocol.types.DocumentRangeFormattingRequest(id, params, method='textDocument/rangeFormatting', jsonrpc='2.0')

A request to format a range in a document.

Parameters:
id: int | str

The request id.

jsonrpc: str
method: Literal['textDocument/rangeFormatting']

The method to be invoked.

params: DocumentRangeFormattingParams
class lsprotocol.types.DocumentRangeFormattingResponse(id, result=None, jsonrpc='2.0')
Parameters:
id: int | str | None

The request id.

jsonrpc: str
result: Sequence[TextEdit] | None
class lsprotocol.types.DocumentRangesFormattingParams(text_document, ranges, options, work_done_token=None)

The parameters of a DocumentRangesFormattingRequest.

LSP v3.18.0 @proposed

Parameters:
options: FormattingOptions

The format options

ranges: Sequence[Range]

The ranges to format

text_document: TextDocumentIdentifier

The document to format.

work_done_token: int | str | None

An optional token that a server can use to report work done progress.

class lsprotocol.types.DocumentRangesFormattingRequest(id, params, method='textDocument/rangesFormatting', jsonrpc='2.0')

A request to format ranges in a document.

LSP v3.18.0 @proposed

Parameters:
id: int | str

The request id.

jsonrpc: str
method: Literal['textDocument/rangesFormatting']

The method to be invoked.

params: DocumentRangesFormattingParams
class lsprotocol.types.DocumentRangesFormattingResponse(id, result=None, jsonrpc='2.0')
Parameters:
id: int | str | None

The request id.

jsonrpc: str
result: Sequence[TextEdit] | None
class lsprotocol.types.DocumentSymbol(name, kind, range, selection_range, detail=None, tags=None, deprecated=None, children=None)

Represents programming constructs like variables, classes, interfaces etc. that appear in a document. Document symbols can be hierarchical and they have two ranges: one that encloses its definition and one that points to its most interesting range, e.g. the range of an identifier.

Parameters:
children: Sequence[DocumentSymbol] | None

Children of this symbol, e.g. properties of a class.

deprecated: bool | None

Indicates if this symbol is deprecated.

@deprecated Use tags instead

detail: str | None

More detail for this symbol, e.g the signature of a function.

kind: SymbolKind

The kind of this symbol.

name: str

The name of this symbol. Will be displayed in the user interface and therefore must not be an empty string or a string only consisting of white spaces.

range: Range

The range enclosing this symbol not including leading/trailing whitespace but everything else like comments. This information is typically used to determine if the clients cursor is inside the symbol to reveal in the symbol in the UI.

selection_range: Range

The range that should be selected and revealed when this symbol is being picked, e.g the name of a function. Must be contained by the range .

tags: Sequence[SymbolTag] | None

Tags for this document symbol.

LSP v3.16.0

class lsprotocol.types.DocumentSymbolClientCapabilities(dynamic_registration=None, symbol_kind=None, hierarchical_document_symbol_support=None, tag_support=None, label_support=None)

Client Capabilities for a DocumentSymbolRequest.

Parameters:
dynamic_registration: bool | None

Whether document symbol supports dynamic registration.

hierarchical_document_symbol_support: bool | None

The client supports hierarchical document symbols.

label_support: bool | None

The client supports an additional label presented in the UI when registering a document symbol provider.

LSP v3.16.0

symbol_kind: ClientSymbolKindOptions | None

Specific capabilities for the SymbolKind in the textDocument/documentSymbol request.

tag_support: ClientSymbolTagOptions | None

The client supports tags on SymbolInformation . Tags are supported on DocumentSymbol if hierarchicalDocumentSymbolSupport is set to true. Clients supporting tags have to handle unknown tags gracefully.

LSP v3.16.0

class lsprotocol.types.DocumentSymbolOptions(label=None, work_done_progress=None)

Provider options for a DocumentSymbolRequest.

Parameters:
  • label (str | None)

  • work_done_progress (bool | None)

label: str | None

A human-readable string that is shown when multiple outlines trees are shown for the same document.

LSP v3.16.0

work_done_progress: bool | None
class lsprotocol.types.DocumentSymbolParams(text_document, work_done_token=None, partial_result_token=None)

Parameters for a DocumentSymbolRequest.

Parameters:
partial_result_token: int | str | None

An optional token that a server can use to report partial results (e.g. streaming) to the client.

text_document: TextDocumentIdentifier

The text document.

work_done_token: int | str | None

An optional token that a server can use to report work done progress.

class lsprotocol.types.DocumentSymbolRegistrationOptions(document_selector=None, label=None, work_done_progress=None)

Registration options for a DocumentSymbolRequest.

Parameters:
document_selector: Sequence[TextDocumentFilterLanguage | TextDocumentFilterScheme | TextDocumentFilterPattern | NotebookCellTextDocumentFilter] | None

A document selector to identify the scope of the registration. If set to null the document selector provided on the client side will be used.

label: str | None

A human-readable string that is shown when multiple outlines trees are shown for the same document.

LSP v3.16.0

work_done_progress: bool | None
class lsprotocol.types.DocumentSymbolRequest(id, params, method='textDocument/documentSymbol', jsonrpc='2.0')

A request to list all symbols found in a given text document. The request’s parameter is of type TextDocumentIdentifier the response is of type SymbolInformation SymbolInformation[] or a Thenable that resolves to such.

Parameters:
id: int | str

The request id.

jsonrpc: str
method: Literal['textDocument/documentSymbol']

The method to be invoked.

params: DocumentSymbolParams
class lsprotocol.types.DocumentSymbolResponse(id, result=None, jsonrpc='2.0')
Parameters:
id: int | str | None

The request id.

jsonrpc: str
result: Sequence[SymbolInformation] | Sequence[DocumentSymbol] | None
class lsprotocol.types.EditRangeWithInsertReplace(insert, replace)

Edit range variant that includes ranges for insert and replace operations.

LSP v3.18.0

Parameters:
insert: Range
replace: Range
class lsprotocol.types.ErrorCodes(value)

Predefined error codes.

InternalError = -32603
InvalidParams = -32602
InvalidRequest = -32600
MethodNotFound = -32601
ParseError = -32700
ServerNotInitialized = -32002

Error code indicating that a server received a notification or request before the server has received the initialize request.

UnknownErrorCode = -32001
class lsprotocol.types.ExecuteCommandClientCapabilities(dynamic_registration=None)

The client capabilities of a ExecuteCommandRequest.

Parameters:

dynamic_registration (bool | None)

dynamic_registration: bool | None

Execute command supports dynamic registration.

class lsprotocol.types.ExecuteCommandOptions(commands, work_done_progress=None)

The server capabilities of a ExecuteCommandRequest.

Parameters:
commands: Sequence[str]

The commands to be executed on the server

work_done_progress: bool | None
class lsprotocol.types.ExecuteCommandParams(command, arguments=None, work_done_token=None)

The parameters of a ExecuteCommandRequest.

Parameters:
arguments: Sequence[Any | None] | None

Arguments that the command should be invoked with.

command: str

The identifier of the actual command handler.

work_done_token: int | str | None

An optional token that a server can use to report work done progress.

class lsprotocol.types.ExecuteCommandRegistrationOptions(commands, work_done_progress=None)

Registration options for a ExecuteCommandRequest.

Parameters:
commands: Sequence[str]

The commands to be executed on the server

work_done_progress: bool | None
class lsprotocol.types.ExecuteCommandRequest(id, params, method='workspace/executeCommand', jsonrpc='2.0')

A request send from the client to the server to execute a command. The request might return a workspace edit which the client will apply to the workspace.

Parameters:
id: int | str

The request id.

jsonrpc: str
method: Literal['workspace/executeCommand']

The method to be invoked.

params: ExecuteCommandParams
class lsprotocol.types.ExecuteCommandResponse(id, result=None, jsonrpc='2.0')
Parameters:
id: int | str | None

The request id.

jsonrpc: str
result: Any | None
class lsprotocol.types.ExecutionSummary(execution_order, success=None)
Parameters:
  • execution_order (int)

  • success (bool | None)

execution_order: int

A strict monotonically increasing value indicating the execution order of a cell inside a notebook.

success: bool | None

Whether the execution was successful or not if known by the client.

class lsprotocol.types.ExitNotification(params=None, method='exit', jsonrpc='2.0')

The exit event is sent from the client to the server to ask the server to exit its process.

Parameters:
  • params (None)

  • method (Literal['exit'])

  • jsonrpc (str)

jsonrpc: str
method: Literal['exit']

The method to be invoked.

params: None
class lsprotocol.types.FailureHandlingKind(value)
Abort = 'abort'

Applying the workspace change is simply aborted if one of the changes provided fails. All operations executed before the failing operation stay executed.

TextOnlyTransactional = 'textOnlyTransactional'

If the workspace edit contains only textual file changes they are executed transactional. If resource changes (create, rename or delete file) are part of the change the failure handling strategy is abort.

Transactional = 'transactional'

All operations are executed transactional. That means they either all succeed or no changes at all are applied to the workspace.

Undo = 'undo'

The client tries to undo the operations already executed. But there is no guarantee that this is succeeding.

class lsprotocol.types.FileChangeType(value)

The file event type

Changed = 2

The file got changed.

Created = 1

The file got created.

Deleted = 3

The file got deleted.

class lsprotocol.types.FileCreate(uri)

Represents information on a file/folder create.

LSP v3.16.0

Parameters:

uri (str)

uri: str

// URI for the location of the file/folder being created.

Type:

A file

class lsprotocol.types.FileDelete(uri)

Represents information on a file/folder delete.

LSP v3.16.0

Parameters:

uri (str)

uri: str

// URI for the location of the file/folder being deleted.

Type:

A file

class lsprotocol.types.FileEvent(uri, type)

An event describing a file change.

Parameters:
type: FileChangeType

The change type.

uri: str

The file’s uri.

class lsprotocol.types.FileOperationClientCapabilities(dynamic_registration=None, did_create=None, will_create=None, did_rename=None, will_rename=None, did_delete=None, will_delete=None)

Capabilities relating to events from file operations by the user in the client.

These events do not come from the file system, they come from user operations like renaming a file in the UI.

LSP v3.16.0

Parameters:
  • dynamic_registration (bool | None)

  • did_create (bool | None)

  • will_create (bool | None)

  • did_rename (bool | None)

  • will_rename (bool | None)

  • did_delete (bool | None)

  • will_delete (bool | None)

did_create: bool | None

The client has support for sending didCreateFiles notifications.

did_delete: bool | None

The client has support for sending didDeleteFiles notifications.

did_rename: bool | None

The client has support for sending didRenameFiles notifications.

dynamic_registration: bool | None

Whether the client supports dynamic registration for file requests/notifications.

will_create: bool | None

The client has support for sending willCreateFiles requests.

will_delete: bool | None

The client has support for sending willDeleteFiles requests.

will_rename: bool | None

The client has support for sending willRenameFiles requests.

class lsprotocol.types.FileOperationFilter(pattern, scheme=None)

A filter to describe in which file operation requests or notifications the server is interested in receiving.

LSP v3.16.0

Parameters:
pattern: FileOperationPattern

The actual file operation pattern.

scheme: str | None

A Uri scheme like file or untitled.

class lsprotocol.types.FileOperationOptions(did_create=None, will_create=None, did_rename=None, will_rename=None, did_delete=None, will_delete=None)

Options for notifications/requests for user operations on files.

LSP v3.16.0

Parameters:
did_create: FileOperationRegistrationOptions | None

The server is interested in receiving didCreateFiles notifications.

did_delete: FileOperationRegistrationOptions | None

The server is interested in receiving didDeleteFiles file notifications.

did_rename: FileOperationRegistrationOptions | None

The server is interested in receiving didRenameFiles notifications.

will_create: FileOperationRegistrationOptions | None

The server is interested in receiving willCreateFiles requests.

will_delete: FileOperationRegistrationOptions | None

The server is interested in receiving willDeleteFiles file requests.

will_rename: FileOperationRegistrationOptions | None

The server is interested in receiving willRenameFiles requests.

class lsprotocol.types.FileOperationPattern(glob, matches=None, options=None)

A pattern to describe in which file operation requests or notifications the server is interested in receiving.

LSP v3.16.0

Parameters:
glob: str

The glob pattern to match. Glob patterns can have the following syntax:

  • * to match one or more characters in a path segment

  • ? to match on one character in a path segment

  • ** to match any number of path segments, including none

  • {} to group sub patterns into an OR expression. (e.g. **/*.{ts,js} matches all TypeScript and JavaScript files)

  • [] to declare a range of characters to match in a path segment (e.g., example.[0-9] to match on example.0, example.1, …)

  • [!...] to negate a range of characters to match in a path segment (e.g., example.[!0-9] to match on example.a, example.b, but not example.0)

matches: FileOperationPatternKind | None

Whether to match files or folders with this pattern.

Matches both if undefined.

options: FileOperationPatternOptions | None

Additional options used during matching.

class lsprotocol.types.FileOperationPatternKind(value)

A pattern kind describing if a glob pattern matches a file a folder or both.

LSP v3.16.0

File = 'file'

The pattern matches a file only.

Folder = 'folder'

The pattern matches a folder only.

class lsprotocol.types.FileOperationPatternOptions(ignore_case=None)

Matching options for the file operation pattern.

LSP v3.16.0

Parameters:

ignore_case (bool | None)

ignore_case: bool | None

The pattern should be matched ignoring casing.

class lsprotocol.types.FileOperationRegistrationOptions(filters)

The options to register for file operations.

LSP v3.16.0

Parameters:

filters (Sequence[FileOperationFilter])

filters: Sequence[FileOperationFilter]

The actual filters.

class lsprotocol.types.FileRename(old_uri, new_uri)

Represents information on a file/folder rename.

LSP v3.16.0

Parameters:
new_uri: str

// URI for the new location of the file/folder being renamed.

Type:

A file

old_uri: str

// URI for the original location of the file/folder being renamed.

Type:

A file

class lsprotocol.types.FileSystemWatcher(glob_pattern, kind=None)
Parameters:
glob_pattern: str | RelativePattern

The glob pattern to watch. See GlobPattern glob pattern for more detail.

LSP v3.17.0 support for relative patterns.

kind: WatchKind | int | None

The kind of events of interest. If omitted it defaults to WatchKind.Create | WatchKind.Change | WatchKind.Delete which is 7.

class lsprotocol.types.FoldingRange(start_line, end_line, start_character=None, end_character=None, kind=None, collapsed_text=None)

Represents a folding range. To be valid, start and end line must be bigger than zero and smaller than the number of lines in the document. Clients are free to ignore invalid ranges.

Parameters:
collapsed_text: str | None

The text that the client should show when the specified range is collapsed. If not defined or not supported by the client, a default will be chosen by the client.

LSP v3.17.0

end_character: int | None

The zero-based character offset before the folded range ends. If not defined, defaults to the length of the end line.

end_line: int

The zero-based end line of the range to fold. The folded area ends with the line’s last character. To be valid, the end must be zero or larger and smaller than the number of lines in the document.

kind: FoldingRangeKind | str | None

Describes the kind of the folding range such as ‘comment’ or ‘region’. The kind is used to categorize folding ranges and used by commands like ‘Fold all comments’. See FoldingRangeKind for an enumeration of standardized kinds.

start_character: int | None

The zero-based character offset from where the folded range starts. If not defined, defaults to the length of the start line.

start_line: int

The zero-based start line of the range to fold. The folded area starts after the line’s last character. To be valid, the end must be zero or larger and smaller than the number of lines in the document.

class lsprotocol.types.FoldingRangeClientCapabilities(dynamic_registration=None, range_limit=None, line_folding_only=None, folding_range_kind=None, folding_range=None)
Parameters:
dynamic_registration: bool | None

Whether implementation supports dynamic registration for folding range providers. If this is set to true the client supports the new FoldingRangeRegistrationOptions return value for the corresponding server capability as well.

folding_range: ClientFoldingRangeOptions | None

Specific options for the folding range.

LSP v3.17.0

folding_range_kind: ClientFoldingRangeKindOptions | None

Specific options for the folding range kind.

LSP v3.17.0

line_folding_only: bool | None

If set, the client signals that it only supports folding complete lines. If set, client will ignore specified startCharacter and endCharacter properties in a FoldingRange.

range_limit: int | None

The maximum number of folding ranges that the client prefers to receive per document. The value serves as a hint, servers are free to follow the limit.

class lsprotocol.types.FoldingRangeKind(value)

A set of predefined range kinds.

Comment = 'comment'

Folding range for a comment

Imports = 'imports'

Folding range for an import or include

Region = 'region'

Folding range for a region (e.g. #region )

class lsprotocol.types.FoldingRangeOptions(work_done_progress=None)
Parameters:

work_done_progress (bool | None)

work_done_progress: bool | None
class lsprotocol.types.FoldingRangeParams(text_document, work_done_token=None, partial_result_token=None)

Parameters for a FoldingRangeRequest.

Parameters:
partial_result_token: int | str | None

An optional token that a server can use to report partial results (e.g. streaming) to the client.

text_document: TextDocumentIdentifier

The text document.

work_done_token: int | str | None

An optional token that a server can use to report work done progress.

class lsprotocol.types.FoldingRangeRefreshRequest(id, params=None, method='workspace/foldingRange/refresh', jsonrpc='2.0')

LSP v3.18.0 @proposed

Parameters:
  • id (int | str)

  • params (None)

  • method (Literal['workspace/foldingRange/refresh'])

  • jsonrpc (str)

id: int | str

The request id.

jsonrpc: str
method: Literal['workspace/foldingRange/refresh']

The method to be invoked.

params: None
class lsprotocol.types.FoldingRangeRefreshResponse(id, result=None, jsonrpc='2.0')
Parameters:
  • id (int | str | None)

  • result (None)

  • jsonrpc (str)

id: int | str | None

The request id.

jsonrpc: str
result: None
class lsprotocol.types.FoldingRangeRegistrationOptions(document_selector=None, work_done_progress=None, id=None)
Parameters:
document_selector: Sequence[TextDocumentFilterLanguage | TextDocumentFilterScheme | TextDocumentFilterPattern | NotebookCellTextDocumentFilter] | None

A document selector to identify the scope of the registration. If set to null the document selector provided on the client side will be used.

id: str | None

The id used to register the request. The id can be used to deregister the request again. See also Registration#id.

work_done_progress: bool | None
class lsprotocol.types.FoldingRangeRequest(id, params, method='textDocument/foldingRange', jsonrpc='2.0')

A request to provide folding ranges in a document. The request’s parameter is of type FoldingRangeParams, the response is of type FoldingRangeList or a Thenable that resolves to such.

Parameters:
id: int | str

The request id.

jsonrpc: str
method: Literal['textDocument/foldingRange']

The method to be invoked.

params: FoldingRangeParams
class lsprotocol.types.FoldingRangeResponse(id, result=None, jsonrpc='2.0')
Parameters:
id: int | str | None

The request id.

jsonrpc: str
result: Sequence[FoldingRange] | None
class lsprotocol.types.FoldingRangeWorkspaceClientCapabilities(refresh_support=None)

Client workspace capabilities specific to folding ranges

LSP v3.18.0 @proposed

Parameters:

refresh_support (bool | None)

refresh_support: bool | None

Whether the client implementation supports a refresh request sent from the server to the client.

Note that this event is global and will force the client to refresh all folding ranges currently shown. It should be used with absolute care and is useful for situation where a server for example detects a project wide change that requires such a calculation.

LSP v3.18.0 @proposed

class lsprotocol.types.FormattingOptions(tab_size, insert_spaces, trim_trailing_whitespace=None, insert_final_newline=None, trim_final_newlines=None)

Value-object describing what options formatting should use.

Parameters:
  • tab_size (int)

  • insert_spaces (bool)

  • trim_trailing_whitespace (bool | None)

  • insert_final_newline (bool | None)

  • trim_final_newlines (bool | None)

insert_final_newline: bool | None

Insert a newline character at the end of the file if one does not exist.

LSP v3.15.0

insert_spaces: bool

Prefer spaces over tabs.

tab_size: int

Size of a tab in spaces.

trim_final_newlines: bool | None

Trim all newlines after the final newline at the end of the file.

LSP v3.15.0

trim_trailing_whitespace: bool | None

Trim trailing whitespace on a line.

LSP v3.15.0

class lsprotocol.types.FullDocumentDiagnosticReport(items, kind='full', result_id=None)

A diagnostic report with a full set of problems.

LSP v3.17.0

Parameters:
items: Sequence[Diagnostic]

The actual items.

kind: str

A full document diagnostic report.

result_id: str | None

An optional result id. If provided it will be sent on the next diagnostic request for the same document.

class lsprotocol.types.GeneralClientCapabilities(stale_request_support=None, regular_expressions=None, markdown=None, position_encodings=None)

General client capabilities.

LSP v3.16.0

Parameters:
markdown: MarkdownClientCapabilities | None

Client capabilities specific to the client’s markdown parser.

LSP v3.16.0

position_encodings: Sequence[PositionEncodingKind | str] | None

The position encodings supported by the client. Client and server have to agree on the same position encoding to ensure that offsets (e.g. character position in a line) are interpreted the same on both sides.

To keep the protocol backwards compatible the following applies: if the value ‘utf-16’ is missing from the array of position encodings servers can assume that the client supports UTF-16. UTF-16 is therefore a mandatory encoding.

If omitted it defaults to [‘utf-16’].

Implementation considerations: since the conversion from one encoding into another requires the content of the file / line the conversion is best done where the file is read which is usually on the server side.

LSP v3.17.0

regular_expressions: RegularExpressionsClientCapabilities | None

Client capabilities specific to regular expressions.

LSP v3.16.0

stale_request_support: StaleRequestSupportOptions | None

Client capability that signals how the client handles stale requests (e.g. a request for which the client will not process the response anymore since the information is outdated).

LSP v3.17.0

class lsprotocol.types.Hover(contents, range=None)

The result of a hover request.

Parameters:
contents: MarkupContent | str | MarkedStringWithLanguage | Sequence[str | MarkedStringWithLanguage]

The hover’s content

range: Range | None

An optional range inside the text document that is used to visualize the hover, e.g. by changing the background color.

class lsprotocol.types.HoverClientCapabilities(dynamic_registration=None, content_format=None)
Parameters:
content_format: Sequence[MarkupKind] | None

Client supports the following content formats for the content property. The order describes the preferred format of the client.

dynamic_registration: bool | None

Whether hover supports dynamic registration.

class lsprotocol.types.HoverOptions(work_done_progress=None)

Hover options.

Parameters:

work_done_progress (bool | None)

work_done_progress: bool | None
class lsprotocol.types.HoverParams(text_document, position, work_done_token=None)

Parameters for a HoverRequest.

Parameters:
position: Position

The position inside the text document.

text_document: TextDocumentIdentifier

The text document.

work_done_token: int | str | None

An optional token that a server can use to report work done progress.

class lsprotocol.types.HoverRegistrationOptions(document_selector=None, work_done_progress=None)

Registration options for a HoverRequest.

Parameters:
document_selector: Sequence[TextDocumentFilterLanguage | TextDocumentFilterScheme | TextDocumentFilterPattern | NotebookCellTextDocumentFilter] | None

A document selector to identify the scope of the registration. If set to null the document selector provided on the client side will be used.

work_done_progress: bool | None
class lsprotocol.types.HoverRequest(id, params, method='textDocument/hover', jsonrpc='2.0')

Request to request hover information at a given text document position. The request’s parameter is of type TextDocumentPosition the response is of type Hover or a Thenable that resolves to such.

Parameters:
id: int | str

The request id.

jsonrpc: str
method: Literal['textDocument/hover']

The method to be invoked.

params: HoverParams
class lsprotocol.types.HoverResponse(id, result=None, jsonrpc='2.0')
Parameters:
id: int | str | None

The request id.

jsonrpc: str
result: Hover | None
class lsprotocol.types.ImplementationClientCapabilities(dynamic_registration=None, link_support=None)

LSP v3.6.0

Parameters:
  • dynamic_registration (bool | None)

  • link_support (bool | None)

dynamic_registration: bool | None

Whether implementation supports dynamic registration. If this is set to true the client supports the new ImplementationRegistrationOptions return value for the corresponding server capability as well.

The client supports additional metadata in the form of definition links.

LSP v3.14.0

class lsprotocol.types.ImplementationOptions(work_done_progress=None)
Parameters:

work_done_progress (bool | None)

work_done_progress: bool | None
class lsprotocol.types.ImplementationParams(text_document, position, work_done_token=None, partial_result_token=None)
Parameters:
partial_result_token: int | str | None

An optional token that a server can use to report partial results (e.g. streaming) to the client.

position: Position

The position inside the text document.

text_document: TextDocumentIdentifier

The text document.

work_done_token: int | str | None

An optional token that a server can use to report work done progress.

class lsprotocol.types.ImplementationRegistrationOptions(document_selector=None, work_done_progress=None, id=None)
Parameters:
document_selector: Sequence[TextDocumentFilterLanguage | TextDocumentFilterScheme | TextDocumentFilterPattern | NotebookCellTextDocumentFilter] | None

A document selector to identify the scope of the registration. If set to null the document selector provided on the client side will be used.

id: str | None

The id used to register the request. The id can be used to deregister the request again. See also Registration#id.

work_done_progress: bool | None
class lsprotocol.types.ImplementationRequest(id, params, method='textDocument/implementation', jsonrpc='2.0')

A request to resolve the implementation locations of a symbol at a given text document position. The request’s parameter is of type TextDocumentPositionParams the response is of type Definition or a Thenable that resolves to such.

Parameters:
id: int | str

The request id.

jsonrpc: str
method: Literal['textDocument/implementation']

The method to be invoked.

params: ImplementationParams
class lsprotocol.types.ImplementationResponse(id, result=None, jsonrpc='2.0')
Parameters:
id: int | str | None

The request id.

jsonrpc: str
result: Location | Sequence[Location] | Sequence[LocationLink] | None
class lsprotocol.types.InitializeError(retry)

The data type of the ResponseError if the initialize request fails.

Parameters:

retry (bool)

retry: bool

Indicates whether the client execute the following retry logic: (1) show the message provided by the ResponseError to the user (2) user selects retry or cancel (3) if user selected retry the initialize method is sent again.

class lsprotocol.types.InitializeParams(capabilities, process_id=None, client_info=None, locale=None, root_path=None, root_uri=None, initialization_options=None, trace=None, work_done_token=None, workspace_folders=None)
Parameters:
capabilities: ClientCapabilities

The capabilities provided by the client (editor or tool)

client_info: ClientInfo | None

Information about the client

LSP v3.15.0

initialization_options: Any | None

User provided initialization options.

locale: str | None

The locale the client is currently showing the user interface in. This must not necessarily be the locale of the operating system.

Uses IETF language tags as the value’s syntax (See https://en.wikipedia.org/wiki/IETF_language_tag)

LSP v3.16.0

process_id: int | None

The process Id of the parent process that started the server.

Is null if the process has not been started by another process. If the parent process is not alive then the server should exit.

root_path: str | None

The rootPath of the workspace. Is null if no folder is open.

@deprecated in favour of rootUri.

root_uri: str | None

The rootUri of the workspace. Is null if no folder is open. If both rootPath and rootUri are set rootUri wins.

@deprecated in favour of workspaceFolders.

trace: TraceValue | None

The initial trace setting. If omitted trace is disabled (‘off’).

work_done_token: int | str | None

An optional token that a server can use to report work done progress.

workspace_folders: Sequence[WorkspaceFolder] | None

The workspace folders configured in the client when the server starts.

This property is only available if the client supports workspace folders. It can be null if the client supports workspace folders but none are configured.

LSP v3.6.0

class lsprotocol.types.InitializeRequest(id, params, method='initialize', jsonrpc='2.0')

The initialize request is sent from the client to the server. It is sent once as the request after starting up the server. The requests parameter is of type InitializeParams the response if of type InitializeResult of a Thenable that resolves to such.

Parameters:
id: int | str

The request id.

jsonrpc: str
method: Literal['initialize']

The method to be invoked.

params: InitializeParams
class lsprotocol.types.InitializeResponse(id, result=None, jsonrpc='2.0')
Parameters:
id: int | str | None

The request id.

jsonrpc: str
result: InitializeResult
class lsprotocol.types.InitializeResult(capabilities, server_info=None)

The result returned from an initialize request.

Parameters:
capabilities: ServerCapabilities

The capabilities the language server provides.

server_info: ServerInfo | None

Information about the server.

LSP v3.15.0

class lsprotocol.types.InitializedNotification(params, method='initialized', jsonrpc='2.0')

The initialized notification is sent from the client to the server after the client is fully initialized and the server is allowed to send requests from the server to the client.

Parameters:
jsonrpc: str
method: Literal['initialized']

The method to be invoked.

params: InitializedParams
class lsprotocol.types.InitializedParams
class lsprotocol.types.InlayHint(position, label, kind=None, text_edits=None, tooltip=None, padding_left=None, padding_right=None, data=None)

Inlay hint information.

LSP v3.17.0

Parameters:
data: Any | None

A data entry field that is preserved on an inlay hint between a textDocument/inlayHint and a inlayHint/resolve request.

kind: InlayHintKind | None

The kind of this hint. Can be omitted in which case the client should fall back to a reasonable default.

label: str | Sequence[InlayHintLabelPart]

The label of this hint. A human readable string or an array of InlayHintLabelPart label parts.

Note that neither the string nor the label part can be empty.

padding_left: bool | None

Render padding before the hint.

Note: Padding should use the editor’s background color, not the background color of the hint itself. That means padding can be used to visually align/separate an inlay hint.

padding_right: bool | None

Render padding after the hint.

Note: Padding should use the editor’s background color, not the background color of the hint itself. That means padding can be used to visually align/separate an inlay hint.

position: Position

The position of this hint.

If multiple hints have the same position, they will be shown in the order they appear in the response.

text_edits: Sequence[TextEdit] | None

Optional text edits that are performed when accepting this inlay hint.

Note that edits are expected to change the document so that the inlay hint (or its nearest variant) is now part of the document and the inlay hint itself is now obsolete.

tooltip: str | MarkupContent | None

The tooltip text when you hover over this item.

class lsprotocol.types.InlayHintClientCapabilities(dynamic_registration=None, resolve_support=None)

Inlay hint client capabilities.

LSP v3.17.0

Parameters:
dynamic_registration: bool | None

Whether inlay hints support dynamic registration.

resolve_support: ClientInlayHintResolveOptions | None

Indicates which properties a client can resolve lazily on an inlay hint.

class lsprotocol.types.InlayHintKind(value)

Inlay hint kinds.

LSP v3.17.0

Parameter = 2

An inlay hint that is for a parameter.

Type = 1

An inlay hint that for a type annotation.

class lsprotocol.types.InlayHintLabelPart(value, tooltip=None, location=None, command=None)

An inlay hint label part allows for interactive and composite labels of inlay hints.

LSP v3.17.0

Parameters:
command: Command | None

An optional command for this label part.

Depending on the client capability inlayHint.resolveSupport clients might resolve this property late using the resolve request.

location: Location | None

An optional source code location that represents this label part.

The editor will use this location for the hover and for code navigation features: This part will become a clickable link that resolves to the definition of the symbol at the given location (not necessarily the location itself), it shows the hover that shows at the given location, and it shows a context menu with further code navigation commands.

Depending on the client capability inlayHint.resolveSupport clients might resolve this property late using the resolve request.

tooltip: str | MarkupContent | None

The tooltip text when you hover over this label part. Depending on the client capability inlayHint.resolveSupport clients might resolve this property late using the resolve request.

value: str

The value of this label part.

class lsprotocol.types.InlayHintOptions(resolve_provider=None, work_done_progress=None)

Inlay hint options used during static registration.

LSP v3.17.0

Parameters:
  • resolve_provider (bool | None)

  • work_done_progress (bool | None)

resolve_provider: bool | None

The server provides support to resolve additional information for an inlay hint item.

work_done_progress: bool | None
class lsprotocol.types.InlayHintParams(text_document, range, work_done_token=None)

A parameter literal used in inlay hint requests.

LSP v3.17.0

Parameters:
range: Range

The document range for which inlay hints should be computed.

text_document: TextDocumentIdentifier

The text document.

work_done_token: int | str | None

An optional token that a server can use to report work done progress.

class lsprotocol.types.InlayHintRefreshRequest(id, params=None, method='workspace/inlayHint/refresh', jsonrpc='2.0')

LSP v3.17.0

Parameters:
  • id (int | str)

  • params (None)

  • method (Literal['workspace/inlayHint/refresh'])

  • jsonrpc (str)

id: int | str

The request id.

jsonrpc: str
method: Literal['workspace/inlayHint/refresh']

The method to be invoked.

params: None
class lsprotocol.types.InlayHintRefreshResponse(id, result=None, jsonrpc='2.0')
Parameters:
  • id (int | str | None)

  • result (None)

  • jsonrpc (str)

id: int | str | None

The request id.

jsonrpc: str
result: None
class lsprotocol.types.InlayHintRegistrationOptions(resolve_provider=None, work_done_progress=None, document_selector=None, id=None)

Inlay hint options used during static or dynamic registration.

LSP v3.17.0

Parameters:
document_selector: Sequence[TextDocumentFilterLanguage | TextDocumentFilterScheme | TextDocumentFilterPattern | NotebookCellTextDocumentFilter] | None

A document selector to identify the scope of the registration. If set to null the document selector provided on the client side will be used.

id: str | None

The id used to register the request. The id can be used to deregister the request again. See also Registration#id.

resolve_provider: bool | None

The server provides support to resolve additional information for an inlay hint item.

work_done_progress: bool | None
class lsprotocol.types.InlayHintRequest(id, params, method='textDocument/inlayHint', jsonrpc='2.0')

A request to provide inlay hints in a document. The request’s parameter is of type InlayHintsParams, the response is of type InlayHint InlayHint[] or a Thenable that resolves to such.

LSP v3.17.0

Parameters:
id: int | str

The request id.

jsonrpc: str
method: Literal['textDocument/inlayHint']

The method to be invoked.

params: InlayHintParams
class lsprotocol.types.InlayHintResolveRequest(id, params, method='inlayHint/resolve', jsonrpc='2.0')

A request to resolve additional properties for an inlay hint. The request’s parameter is of type InlayHint, the response is of type InlayHint or a Thenable that resolves to such.

LSP v3.17.0

Parameters:
id: int | str

The request id.

jsonrpc: str
method: Literal['inlayHint/resolve']

The method to be invoked.

params: InlayHint
class lsprotocol.types.InlayHintResolveResponse(id, result=None, jsonrpc='2.0')
Parameters:
id: int | str | None

The request id.

jsonrpc: str
result: InlayHint
class lsprotocol.types.InlayHintResponse(id, result=None, jsonrpc='2.0')
Parameters:
id: int | str | None

The request id.

jsonrpc: str
result: Sequence[InlayHint] | None
class lsprotocol.types.InlayHintWorkspaceClientCapabilities(refresh_support=None)

Client workspace capabilities specific to inlay hints.

LSP v3.17.0

Parameters:

refresh_support (bool | None)

refresh_support: bool | None

Whether the client implementation supports a refresh request sent from the server to the client.

Note that this event is global and will force the client to refresh all inlay hints currently shown. It should be used with absolute care and is useful for situation where a server for example detects a project wide change that requires such a calculation.

class lsprotocol.types.InlineCompletionClientCapabilities(dynamic_registration=None)

Client capabilities specific to inline completions.

LSP v3.18.0 @proposed

Parameters:

dynamic_registration (bool | None)

dynamic_registration: bool | None

Whether implementation supports dynamic registration for inline completion providers.

class lsprotocol.types.InlineCompletionContext(trigger_kind, selected_completion_info=None)

Provides information about the context in which an inline completion was requested.

LSP v3.18.0 @proposed

Parameters:
selected_completion_info: SelectedCompletionInfo | None

Provides information about the currently selected item in the autocomplete widget if it is visible.

trigger_kind: InlineCompletionTriggerKind

Describes how the inline completion was triggered.

class lsprotocol.types.InlineCompletionItem(insert_text, filter_text=None, range=None, command=None)

An inline completion item represents a text snippet that is proposed inline to complete text that is being typed.

LSP v3.18.0 @proposed

Parameters:
command: Command | None

An optional Command that is executed after inserting this completion.

filter_text: str | None

A text that is used to decide if this inline completion should be shown. When falsy the {@link InlineCompletionItem.insertText} is used.

insert_text: str | StringValue

The text to replace the range with. Must be set.

range: Range | None

The range to replace. Must begin and end on the same line.

class lsprotocol.types.InlineCompletionList(items)

Represents a collection of InlineCompletionItem inline completion items to be presented in the editor.

LSP v3.18.0 @proposed

Parameters:

items (Sequence[InlineCompletionItem])

items: Sequence[InlineCompletionItem]

The inline completion items

class lsprotocol.types.InlineCompletionOptions(work_done_progress=None)

Inline completion options used during static registration.

LSP v3.18.0 @proposed

Parameters:

work_done_progress (bool | None)

work_done_progress: bool | None
class lsprotocol.types.InlineCompletionParams(context, text_document, position, work_done_token=None)

A parameter literal used in inline completion requests.

LSP v3.18.0 @proposed

Parameters:
context: InlineCompletionContext

Additional information about the context in which inline completions were requested.

position: Position

The position inside the text document.

text_document: TextDocumentIdentifier

The text document.

work_done_token: int | str | None

An optional token that a server can use to report work done progress.

class lsprotocol.types.InlineCompletionRegistrationOptions(work_done_progress=None, document_selector=None, id=None)

Inline completion options used during static or dynamic registration.

LSP v3.18.0 @proposed

Parameters:
document_selector: Sequence[TextDocumentFilterLanguage | TextDocumentFilterScheme | TextDocumentFilterPattern | NotebookCellTextDocumentFilter] | None

A document selector to identify the scope of the registration. If set to null the document selector provided on the client side will be used.

id: str | None

The id used to register the request. The id can be used to deregister the request again. See also Registration#id.

work_done_progress: bool | None
class lsprotocol.types.InlineCompletionRequest(id, params, method='textDocument/inlineCompletion', jsonrpc='2.0')

A request to provide inline completions in a document. The request’s parameter is of type InlineCompletionParams, the response is of type InlineCompletion InlineCompletion[] or a Thenable that resolves to such.

LSP v3.18.0 @proposed

Parameters:
id: int | str

The request id.

jsonrpc: str
method: Literal['textDocument/inlineCompletion']

The method to be invoked.

params: InlineCompletionParams
class lsprotocol.types.InlineCompletionResponse(id, result=None, jsonrpc='2.0')
Parameters:
id: int | str | None

The request id.

jsonrpc: str
result: InlineCompletionList | Sequence[InlineCompletionItem] | None
class lsprotocol.types.InlineCompletionTriggerKind(value)

Describes how an InlineCompletionItemProvider inline completion provider was triggered.

LSP v3.18.0 @proposed

Automatic = 2

Completion was triggered automatically while editing.

Invoked = 1

Completion was triggered explicitly by a user gesture.

class lsprotocol.types.InlineValueClientCapabilities(dynamic_registration=None)

Client capabilities specific to inline values.

LSP v3.17.0

Parameters:

dynamic_registration (bool | None)

dynamic_registration: bool | None

Whether implementation supports dynamic registration for inline value providers.

class lsprotocol.types.InlineValueContext(frame_id, stopped_location)

LSP v3.17.0

Parameters:
  • frame_id (int)

  • stopped_location (Range)

frame_id: int

The stack frame (as a DAP Id) where the execution has stopped.

stopped_location: Range

The document range where execution has stopped. Typically the end position of the range denotes the line where the inline values are shown.

class lsprotocol.types.InlineValueEvaluatableExpression(range, expression=None)

Provide an inline value through an expression evaluation. If only a range is specified, the expression will be extracted from the underlying document. An optional expression can be used to override the extracted expression.

LSP v3.17.0

Parameters:
expression: str | None

If specified the expression overrides the extracted expression.

range: Range

The document range for which the inline value applies. The range is used to extract the evaluatable expression from the underlying document.

class lsprotocol.types.InlineValueOptions(work_done_progress=None)

Inline value options used during static registration.

LSP v3.17.0

Parameters:

work_done_progress (bool | None)

work_done_progress: bool | None
class lsprotocol.types.InlineValueParams(text_document, range, context, work_done_token=None)

A parameter literal used in inline value requests.

LSP v3.17.0

Parameters:
context: InlineValueContext

Additional information about the context in which inline values were requested.

range: Range

The document range for which inline values should be computed.

text_document: TextDocumentIdentifier

The text document.

work_done_token: int | str | None

An optional token that a server can use to report work done progress.

class lsprotocol.types.InlineValueRefreshRequest(id, params=None, method='workspace/inlineValue/refresh', jsonrpc='2.0')

LSP v3.17.0

Parameters:
  • id (int | str)

  • params (None)

  • method (Literal['workspace/inlineValue/refresh'])

  • jsonrpc (str)

id: int | str

The request id.

jsonrpc: str
method: Literal['workspace/inlineValue/refresh']

The method to be invoked.

params: None
class lsprotocol.types.InlineValueRefreshResponse(id, result=None, jsonrpc='2.0')
Parameters:
  • id (int | str | None)

  • result (None)

  • jsonrpc (str)

id: int | str | None

The request id.

jsonrpc: str
result: None
class lsprotocol.types.InlineValueRegistrationOptions(work_done_progress=None, document_selector=None, id=None)

Inline value options used during static or dynamic registration.

LSP v3.17.0

Parameters:
document_selector: Sequence[TextDocumentFilterLanguage | TextDocumentFilterScheme | TextDocumentFilterPattern | NotebookCellTextDocumentFilter] | None

A document selector to identify the scope of the registration. If set to null the document selector provided on the client side will be used.

id: str | None

The id used to register the request. The id can be used to deregister the request again. See also Registration#id.

work_done_progress: bool | None
class lsprotocol.types.InlineValueRequest(id, params, method='textDocument/inlineValue', jsonrpc='2.0')

A request to provide inline values in a document. The request’s parameter is of type InlineValueParams, the response is of type InlineValue InlineValue[] or a Thenable that resolves to such.

LSP v3.17.0

Parameters:
id: int | str

The request id.

jsonrpc: str
method: Literal['textDocument/inlineValue']

The method to be invoked.

params: InlineValueParams
class lsprotocol.types.InlineValueResponse(id, result=None, jsonrpc='2.0')
Parameters:
id: int | str | None

The request id.

jsonrpc: str
result: Sequence[InlineValueText | InlineValueVariableLookup | InlineValueEvaluatableExpression] | None
class lsprotocol.types.InlineValueText(range, text)

Provide inline value as text.

LSP v3.17.0

Parameters:
range: Range

The document range for which the inline value applies.

text: str

The text of the inline value.

class lsprotocol.types.InlineValueVariableLookup(range, case_sensitive_lookup, variable_name=None)

Provide inline value through a variable lookup. If only a range is specified, the variable name will be extracted from the underlying document. An optional variable name can be used to override the extracted name.

LSP v3.17.0

Parameters:
  • range (Range)

  • case_sensitive_lookup (bool)

  • variable_name (str | None)

case_sensitive_lookup: bool

How to perform the lookup.

range: Range

The document range for which the inline value applies. The range is used to extract the variable name from the underlying document.

variable_name: str | None

If specified the name of the variable to look up.

class lsprotocol.types.InlineValueWorkspaceClientCapabilities(refresh_support=None)

Client workspace capabilities specific to inline values.

LSP v3.17.0

Parameters:

refresh_support (bool | None)

refresh_support: bool | None

Whether the client implementation supports a refresh request sent from the server to the client.

Note that this event is global and will force the client to refresh all inline values currently shown. It should be used with absolute care and is useful for situation where a server for example detects a project wide change that requires such a calculation.

class lsprotocol.types.InsertReplaceEdit(new_text, insert, replace)

A special text edit to provide an insert and a replace operation.

LSP v3.16.0

Parameters:
insert: Range

The range if the insert is requested

new_text: str

The string to be inserted.

replace: Range

The range if the replace is requested.

class lsprotocol.types.InsertTextFormat(value)

Defines whether the insert text in a completion item should be interpreted as plain text or a snippet.

PlainText = 1

The primary text to be inserted is treated as a plain string.

Snippet = 2

The primary text to be inserted is treated as a snippet.

A snippet can define tab stops and placeholders with $1 , $2 and ${3:foo} . $0 defines the final tab stop, it defaults to the end of the snippet. Placeholders with equal identifiers are linked, that is typing in one will update others too.

See also: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#snippet_syntax

class lsprotocol.types.InsertTextMode(value)

How whitespace and indentation is handled during completion item insertion.

LSP v3.16.0

AdjustIndentation = 2

The editor adjusts leading whitespace of new lines so that they match the indentation up to the cursor of the line for which the item is accepted.

Consider a line like this: <2tabs><cursor><3tabs>foo. Accepting a multi line completion item is indented using 2 tabs and all following lines inserted will be indented using 2 tabs as well.

AsIs = 1

The insertion or replace strings is taken as it is. If the value is multi line the lines below the cursor will be inserted using the indentation defined in the string value. The client will not apply any kind of adjustments to the string.

class lsprotocol.types.LSPErrorCodes(value)
ContentModified = -32801

The server detected that the content of a document got modified outside normal conditions. A server should NOT send this error code if it detects a content change in it unprocessed messages. The result even computed on an older state might still be useful for the client.

If a client decides that a result is not of any use anymore the client should cancel the request.

RequestCancelled = -32800

The client has canceled a request and a server has detected the cancel.

RequestFailed = -32803

A request failed but it was syntactically correct, e.g the method name was known and the parameters were valid. The error message should contain human readable information about why the request failed.

LSP v3.17.0

ServerCancelled = -32802

The server cancelled the request. This error code should only be used for requests that explicitly support being server cancellable.

LSP v3.17.0

class lsprotocol.types.LSPObject

LSP object definition. LSP v3.17.0

class lsprotocol.types.LanguageKind(value)

Predefined Language kinds LSP v3.18.0

Abap = 'abap'
BibTeX = 'bibtex'
C = 'c'
CSharp = 'csharp'
Clojure = 'clojure'
Coffeescript = 'coffeescript'
Cpp = 'cpp'
Css = 'css'
D = 'd'

LSP v3.18.0 @proposed

Dart = 'dart'
Delphi = 'pascal'

LSP v3.18.0 @proposed

Diff = 'diff'
Dockerfile = 'dockerfile'
Elixir = 'elixir'
Erlang = 'erlang'
FSharp = 'fsharp'
GitCommit = 'git-commit'
GitRebase = 'rebase'
Go = 'go'
Groovy = 'groovy'
Handlebars = 'handlebars'
Haskell = 'haskell'
Html = 'html'
Ini = 'ini'
Java = 'java'
JavaScript = 'javascript'
JavaScriptReact = 'javascriptreact'
Json = 'json'
LaTeX = 'latex'
Less = 'less'
Lua = 'lua'
Makefile = 'makefile'
Markdown = 'markdown'
ObjectiveC = 'objective-c'
ObjectiveCpp = 'objective-cpp'
Pascal = 'pascal'

LSP v3.18.0 @proposed

Perl = 'perl'
Perl6 = 'perl6'
Php = 'php'
Powershell = 'powershell'
Pug = 'jade'
Python = 'python'
R = 'r'
Razor = 'razor'
Ruby = 'ruby'
Rust = 'rust'
Sass = 'sass'
Scala = 'scala'
Scss = 'scss'
ShaderLab = 'shaderlab'
ShellScript = 'shellscript'
Sql = 'sql'
Swift = 'swift'
TeX = 'tex'
TypeScript = 'typescript'
TypeScriptReact = 'typescriptreact'
VisualBasic = 'vb'
WindowsBat = 'bat'
Xml = 'xml'
Xsl = 'xsl'
Yaml = 'yaml'
class lsprotocol.types.LinkedEditingRangeClientCapabilities(dynamic_registration=None)

Client capabilities for the linked editing range request.

LSP v3.16.0

Parameters:

dynamic_registration (bool | None)

dynamic_registration: bool | None

Whether implementation supports dynamic registration. If this is set to true the client supports the new (TextDocumentRegistrationOptions & StaticRegistrationOptions) return value for the corresponding server capability as well.

class lsprotocol.types.LinkedEditingRangeOptions(work_done_progress=None)
Parameters:

work_done_progress (bool | None)

work_done_progress: bool | None
class lsprotocol.types.LinkedEditingRangeParams(text_document, position, work_done_token=None)
Parameters:
position: Position

The position inside the text document.

text_document: TextDocumentIdentifier

The text document.

work_done_token: int | str | None

An optional token that a server can use to report work done progress.

class lsprotocol.types.LinkedEditingRangeRegistrationOptions(document_selector=None, work_done_progress=None, id=None)
Parameters:
document_selector: Sequence[TextDocumentFilterLanguage | TextDocumentFilterScheme | TextDocumentFilterPattern | NotebookCellTextDocumentFilter] | None

A document selector to identify the scope of the registration. If set to null the document selector provided on the client side will be used.

id: str | None

The id used to register the request. The id can be used to deregister the request again. See also Registration#id.

work_done_progress: bool | None
class lsprotocol.types.LinkedEditingRangeRequest(id, params, method='textDocument/linkedEditingRange', jsonrpc='2.0')

A request to provide ranges that can be edited together.

LSP v3.16.0

Parameters:
id: int | str

The request id.

jsonrpc: str
method: Literal['textDocument/linkedEditingRange']

The method to be invoked.

params: LinkedEditingRangeParams
class lsprotocol.types.LinkedEditingRangeResponse(id, result=None, jsonrpc='2.0')
Parameters:
id: int | str | None

The request id.

jsonrpc: str
result: LinkedEditingRanges | None
class lsprotocol.types.LinkedEditingRanges(ranges, word_pattern=None)

The result of a linked editing range request.

LSP v3.16.0

Parameters:
ranges: Sequence[Range]

A list of ranges that can be edited together. The ranges must have identical length and contain identical text content. The ranges cannot overlap.

word_pattern: str | None

An optional word pattern (regular expression) that describes valid contents for the given ranges. If no pattern is provided, the client configuration’s word pattern will be used.

class lsprotocol.types.Location(uri, range)

Represents a location inside a resource, such as a line inside a text file.

Parameters:
range: Range
uri: str

Represents the connection of two locations. Provides additional metadata over normal Location locations, including an origin range.

Parameters:
  • target_uri (str)

  • target_range (Range)

  • target_selection_range (Range)

  • origin_selection_range (Range | None)

origin_selection_range: Range | None

Span of the origin of this link.

Used as the underlined span for mouse interaction. Defaults to the word range at the definition position.

target_range: Range

The full target range of this link. If the target for example is a symbol then target range is the range enclosing this symbol not including leading/trailing whitespace but everything else like comments. This information is typically used to highlight the range in the editor.

target_selection_range: Range

The range that should be selected and revealed when this link is being followed, e.g the name of a function. Must be contained by the targetRange . See also DocumentSymbol#range

target_uri: str

The target resource identifier of this link.

class lsprotocol.types.LocationUriOnly(uri)

Location with only uri and does not include range.

LSP v3.18.0

Parameters:

uri (str)

uri: str
class lsprotocol.types.LogMessageNotification(params, method='window/logMessage', jsonrpc='2.0')

The log message notification is sent from the server to the client to ask the client to log a particular message.

Parameters:
jsonrpc: str
method: Literal['window/logMessage']

The method to be invoked.

params: LogMessageParams
class lsprotocol.types.LogMessageParams(type, message)

The log message parameters.

Parameters:
message: str

The actual message.

type: MessageType

The message type. See MessageType

class lsprotocol.types.LogTraceNotification(params, method='$/logTrace', jsonrpc='2.0')
Parameters:
jsonrpc: str
method: Literal['$/logTrace']

The method to be invoked.

params: LogTraceParams
class lsprotocol.types.LogTraceParams(message, verbose=None)
Parameters:
  • message (str)

  • verbose (str | None)

message: str
verbose: str | None
class lsprotocol.types.MarkdownClientCapabilities(parser, version=None, allowed_tags=None)

Client capabilities specific to the used markdown parser.

LSP v3.16.0

Parameters:
allowed_tags: Sequence[str] | None

A list of HTML tags that the client allows / supports in Markdown.

LSP v3.17.0

parser: str

The name of the parser.

version: str | None

The version of the parser.

class lsprotocol.types.MarkedStringWithLanguage(language, value)

LSP v3.18.0 @deprecated use MarkupContent instead.

Parameters:
language: str
value: str
class lsprotocol.types.MarkupContent(kind, value)

A MarkupContent literal represents a string value which content is interpreted base on its kind flag. Currently the protocol supports plaintext and markdown as markup kinds.

If the kind is markdown then the value can contain fenced code blocks like in GitHub issues. See https://help.github.com/articles/creating-and-highlighting-code-blocks/#syntax-highlighting

Here is an example how such a string can be constructed using JavaScript / TypeScript:

let markdown: MarkdownContent = {
 kind: MarkupKind.Markdown,
     value: [
       '# Header',
       'Some text',
       '```typescript',
       'someCode();',
       '```'
     ].join('
')
};

Please Note that clients might sanitize the return markdown. A client could decide to remove HTML from the markdown to avoid script execution.

Parameters:
kind: MarkupKind

The type of the Markup

value: str

The content itself

class lsprotocol.types.MarkupKind(value)

Describes the content type that a client supports in various result literals like Hover , ParameterInfo or CompletionItem.

Please note that MarkupKinds must not start with a $. This kinds are reserved for internal usage.

Markdown = 'markdown'

Markdown is supported as a content format

PlainText = 'plaintext'

Plain text is supported as a content format

class lsprotocol.types.MessageActionItem(title)
Parameters:

title (str)

title: str

A short title like ‘Retry’, ‘Open Log’ etc.

class lsprotocol.types.MessageDirection(value)
Both = 'both'
ClientToServer = 'clientToServer'
ServerToClient = 'serverToClient'
class lsprotocol.types.MessageType(value)

The message type

Debug = 5

A debug message.

LSP v3.18.0 @proposed

Error = 1

An error message.

Info = 3

An information message.

Log = 4

A log message.

Warning = 2

A warning message.

class lsprotocol.types.Moniker(scheme, identifier, unique, kind=None)

Moniker definition to match LSIF 0.5 moniker definition.

LSP v3.16.0

Parameters:
identifier: str

The identifier of the moniker. The value is opaque in LSIF however schema owners are allowed to define the structure if they want.

kind: MonikerKind | None

The moniker kind if known.

scheme: str

The scheme of the moniker. For example tsc or .Net

unique: UniquenessLevel

The scope in which the moniker is unique

class lsprotocol.types.MonikerClientCapabilities(dynamic_registration=None)

Client capabilities specific to the moniker request.

LSP v3.16.0

Parameters:

dynamic_registration (bool | None)

dynamic_registration: bool | None

Whether moniker supports dynamic registration. If this is set to true the client supports the new MonikerRegistrationOptions return value for the corresponding server capability as well.

class lsprotocol.types.MonikerKind(value)

The moniker kind.

LSP v3.16.0

Export = 'export'

The moniker represents a symbol that is exported from a project

Import = 'import'

The moniker represent a symbol that is imported into a project

Local = 'local'

The moniker represents a symbol that is local to a project (e.g. a local variable of a function, a class not visible outside the project, …)

class lsprotocol.types.MonikerOptions(work_done_progress=None)
Parameters:

work_done_progress (bool | None)

work_done_progress: bool | None
class lsprotocol.types.MonikerParams(text_document, position, work_done_token=None, partial_result_token=None)
Parameters:
partial_result_token: int | str | None

An optional token that a server can use to report partial results (e.g. streaming) to the client.

position: Position

The position inside the text document.

text_document: TextDocumentIdentifier

The text document.

work_done_token: int | str | None

An optional token that a server can use to report work done progress.

class lsprotocol.types.MonikerRegistrationOptions(document_selector=None, work_done_progress=None)
Parameters:
document_selector: Sequence[TextDocumentFilterLanguage | TextDocumentFilterScheme | TextDocumentFilterPattern | NotebookCellTextDocumentFilter] | None

A document selector to identify the scope of the registration. If set to null the document selector provided on the client side will be used.

work_done_progress: bool | None
class lsprotocol.types.MonikerRequest(id, params, method='textDocument/moniker', jsonrpc='2.0')

A request to get the moniker of a symbol at a given text document position. The request parameter is of type TextDocumentPositionParams. The response is of type {@link Moniker Moniker[]} or null .

Parameters:
id: int | str

The request id.

jsonrpc: str
method: Literal['textDocument/moniker']

The method to be invoked.

params: MonikerParams
class lsprotocol.types.MonikerResponse(id, result=None, jsonrpc='2.0')
Parameters:
id: int | str | None

The request id.

jsonrpc: str
result: Sequence[Moniker] | None
class lsprotocol.types.NotebookCell(kind, document, metadata=None, execution_summary=None)

A notebook cell.

A cell’s document URI must be unique across ALL notebook cells and can therefore be used to uniquely identify a notebook cell or the cell’s text document.

LSP v3.17.0

Parameters:
document: str

The URI of the cell’s text document content.

execution_summary: ExecutionSummary | None

Additional execution summary information if supported by the client.

kind: NotebookCellKind

The cell’s kind

metadata: LSPObject | None

Additional metadata stored with the cell.

Note: should always be an object literal (e.g. LSPObject)

class lsprotocol.types.NotebookCellArrayChange(start, delete_count, cells=None)

A change describing how to move a NotebookCell array from state S to S’.

LSP v3.17.0

Parameters:
cells: Sequence[NotebookCell] | None

The new cells, if any

delete_count: int

The deleted cells

start: int

The start oftest of the cell that changed.

class lsprotocol.types.NotebookCellKind(value)

A notebook cell kind.

LSP v3.17.0

Code = 2

A code-cell is source code.

Markup = 1

A markup-cell is formatted source that is used for display.

class lsprotocol.types.NotebookCellLanguage(language)

LSP v3.18.0

Parameters:

language (str)

language: str
class lsprotocol.types.NotebookCellTextDocumentFilter(notebook, language=None)

A notebook cell text document filter denotes a cell text document by different properties.

LSP v3.17.0

Parameters:
language: str | None

A language id like python .

Will be matched against the language id of the notebook cell document. ‘*’ matches every language.

notebook: str | NotebookDocumentFilterNotebookType | NotebookDocumentFilterScheme | NotebookDocumentFilterPattern

A filter that matches against the notebook containing the notebook cell. If a string value is provided it matches against the notebook type. ‘*’ matches every notebook.

class lsprotocol.types.NotebookDocument(uri, notebook_type, version, cells, metadata=None)

A notebook document.

LSP v3.17.0

Parameters:
cells: Sequence[NotebookCell]

The cells of a notebook.

metadata: LSPObject | None

Additional metadata stored with the notebook document.

Note: should always be an object literal (e.g. LSPObject)

notebook_type: str

The type of the notebook.

uri: str

The notebook document’s uri.

version: int

The version number of this document (it will increase after each change, including undo/redo).

class lsprotocol.types.NotebookDocumentCellChangeStructure(array, did_open=None, did_close=None)

Structural changes to cells in a notebook document.

LSP v3.18.0

Parameters:
array: NotebookCellArrayChange

The change to the cell array.

did_close: Sequence[TextDocumentIdentifier] | None

Additional closed cell text documents.

did_open: Sequence[TextDocumentItem] | None

Additional opened cell text documents.

class lsprotocol.types.NotebookDocumentCellChanges(structure=None, data=None, text_content=None)

Cell changes to a notebook document.

LSP v3.18.0

Parameters:
data: Sequence[NotebookCell] | None

Changes to notebook cells properties like its kind, execution summary or metadata.

structure: NotebookDocumentCellChangeStructure | None

Changes to the cell structure to add or remove cells.

text_content: Sequence[NotebookDocumentCellContentChanges] | None

Changes to the text content of notebook cells.

class lsprotocol.types.NotebookDocumentCellContentChanges(document, changes)

Content changes to a cell in a notebook document.

LSP v3.18.0

Parameters:
changes: Sequence[TextDocumentContentChangePartial | TextDocumentContentChangeWholeDocument]
document: VersionedTextDocumentIdentifier
class lsprotocol.types.NotebookDocumentChangeEvent(metadata=None, cells=None)

A change event for a notebook document.

LSP v3.17.0

Parameters:
cells: NotebookDocumentCellChanges | None

Changes to cells

metadata: LSPObject | None

The changed meta data if any.

Note: should always be an object literal (e.g. LSPObject)

class lsprotocol.types.NotebookDocumentClientCapabilities(synchronization)

Capabilities specific to the notebook document support.

LSP v3.17.0

Parameters:

synchronization (NotebookDocumentSyncClientCapabilities)

synchronization: NotebookDocumentSyncClientCapabilities

Capabilities specific to notebook document synchronization

LSP v3.17.0

class lsprotocol.types.NotebookDocumentFilterNotebookType(notebook_type, scheme=None, pattern=None)

A notebook document filter where notebookType is required field.

LSP v3.18.0

Parameters:
notebook_type: str

The type of the enclosing notebook.

pattern: str | RelativePattern | None

A glob pattern.

scheme: str | None

A Uri {@link Uri.scheme scheme}, like file or untitled.

class lsprotocol.types.NotebookDocumentFilterPattern(pattern, notebook_type=None, scheme=None)

A notebook document filter where pattern is required field.

LSP v3.18.0

Parameters:
notebook_type: str | None

The type of the enclosing notebook.

pattern: str | RelativePattern

A glob pattern.

scheme: str | None

A Uri {@link Uri.scheme scheme}, like file or untitled.

class lsprotocol.types.NotebookDocumentFilterScheme(scheme, notebook_type=None, pattern=None)

A notebook document filter where scheme is required field.

LSP v3.18.0

Parameters:
notebook_type: str | None

The type of the enclosing notebook.

pattern: str | RelativePattern | None

A glob pattern.

scheme: str

A Uri {@link Uri.scheme scheme}, like file or untitled.

class lsprotocol.types.NotebookDocumentFilterWithCells(cells, notebook=None)

LSP v3.18.0

Parameters:
cells: Sequence[NotebookCellLanguage]

The cells of the matching notebook to be synced.

notebook: str | NotebookDocumentFilterNotebookType | NotebookDocumentFilterScheme | NotebookDocumentFilterPattern | None

The notebook to be synced If a string value is provided it matches against the notebook type. ‘*’ matches every notebook.

class lsprotocol.types.NotebookDocumentFilterWithNotebook(notebook, cells=None)

LSP v3.18.0

Parameters:
cells: Sequence[NotebookCellLanguage] | None

The cells of the matching notebook to be synced.

notebook: str | NotebookDocumentFilterNotebookType | NotebookDocumentFilterScheme | NotebookDocumentFilterPattern

The notebook to be synced If a string value is provided it matches against the notebook type. ‘*’ matches every notebook.

class lsprotocol.types.NotebookDocumentIdentifier(uri)

A literal to identify a notebook document in the client.

LSP v3.17.0

Parameters:

uri (str)

uri: str

The notebook document’s uri.

class lsprotocol.types.NotebookDocumentSyncClientCapabilities(dynamic_registration=None, execution_summary_support=None)

Notebook specific client capabilities.

LSP v3.17.0

Parameters:
  • dynamic_registration (bool | None)

  • execution_summary_support (bool | None)

dynamic_registration: bool | None

Whether implementation supports dynamic registration. If this is set to true the client supports the new (TextDocumentRegistrationOptions & StaticRegistrationOptions) return value for the corresponding server capability as well.

execution_summary_support: bool | None

The client supports sending execution summary data per cell.

class lsprotocol.types.NotebookDocumentSyncOptions(notebook_selector, save=None)

Options specific to a notebook plus its cells to be synced to the server.

If a selector provides a notebook document filter but no cell selector all cells of a matching notebook document will be synced.

If a selector provides no notebook document filter but only a cell selector all notebook document that contain at least one matching cell will be synced.

LSP v3.17.0

Parameters:
notebook_selector: Sequence[NotebookDocumentFilterWithNotebook | NotebookDocumentFilterWithCells]

The notebooks to be synced

save: bool | None

Whether save notification should be forwarded to the server. Will only be honored if mode === notebook .

class lsprotocol.types.NotebookDocumentSyncRegistrationOptions(notebook_selector, save=None, id=None)

Registration options specific to a notebook.

LSP v3.17.0

Parameters:
id: str | None

The id used to register the request. The id can be used to deregister the request again. See also Registration#id.

notebook_selector: Sequence[NotebookDocumentFilterWithNotebook | NotebookDocumentFilterWithCells]

The notebooks to be synced

save: bool | None

Whether save notification should be forwarded to the server. Will only be honored if mode === notebook .

class lsprotocol.types.OptionalVersionedTextDocumentIdentifier(uri, version=None)

A text document identifier to optionally denote a specific version of a text document.

Parameters:
  • uri (str)

  • version (int | None)

uri: str

The text document’s uri.

version: int | None

The version number of this document. If a versioned text document identifier is sent from the server to the client and the file is not open in the editor (the server has not received an open notification before) the server can send null to indicate that the version is unknown and the content on disk is the truth (as specified with document content ownership).

class lsprotocol.types.ParameterInformation(label, documentation=None)

Represents a parameter of a callable-signature. A parameter can have a label and a doc-comment.

Parameters:
documentation: str | MarkupContent | None

The human-readable doc-comment of this parameter. Will be shown in the UI but can be omitted.

label: str | Tuple[int, int]

The label of this parameter information.

Either a string or an inclusive start and exclusive end offsets within its containing signature label. (see SignatureInformation.label). The offsets are based on a UTF-16 string representation as Position and Range does.

To avoid ambiguities a server should use the [start, end] offset value instead of using a substring. Whether a client support this is controlled via labelOffsetSupport client capability.

Note: a label of type string should be a substring of its containing signature label. Its intended use case is to highlight the parameter label part in the SignatureInformation.label .

class lsprotocol.types.PartialResultParams(partial_result_token=None)
Parameters:

partial_result_token (int | str | None)

partial_result_token: int | str | None

An optional token that a server can use to report partial results (e.g. streaming) to the client.

lsprotocol.types.Pattern

The glob pattern to watch relative to the base path. Glob patterns can have the following syntax:

  • * to match one or more characters in a path segment

  • ? to match on one character in a path segment

  • ** to match any number of path segments, including none

  • {} to group conditions (e.g. **/*.{ts,js} matches all TypeScript and JavaScript files)

  • [] to declare a range of characters to match in a path segment (e.g., example.[0-9] to match on example.0, example.1, …)

  • [!...] to negate a range of characters to match in a path segment (e.g., example.[!0-9] to match on example.a, example.b, but not example.0)

LSP v3.17.0

class lsprotocol.types.Position(line, character)

Position in a text document expressed as zero-based line and character offset. Prior to 3.17 the offsets were always based on a UTF-16 string representation. So a string of the form a𐐀b the character offset of the character a is 0, the character offset of 𐐀 is 1 and the character offset of b is 3 since 𐐀 is represented using two code units in UTF-16. Since 3.17 clients and servers can agree on a different string encoding representation (e.g. UTF-8). The client announces it’s supported encoding via the client capability general.positionEncodings. The value is an array of position encodings the client supports, with decreasing preference (e.g. the encoding at index 0 is the most preferred one). To stay backwards compatible the only mandatory encoding is UTF-16 represented via the string utf-16 . The server can pick one of the encodings offered by the client and signals that encoding back to the client via the initialize result’s property capabilities.positionEncoding. If the string value utf-16 is missing from the client’s capability general.positionEncodings servers can safely assume that the client supports UTF-16. If the server omits the position encoding in its initialize result the encoding defaults to the string value utf-16 . Implementation considerations: since the conversion from one encoding into another requires the content of the file / line the conversion is best done where the file is read which is usually on the server side.

Positions are line end character agnostic. So you can not specify a position that denotes ` | `` or `` |`` where `` |` represents the character offset.

LSP v3.17.0 - support for negotiated position encoding.

Parameters:
character: int

Character offset on a line in a document (zero-based).

The meaning of this offset is determined by the negotiated PositionEncodingKind .

line: int

Line position in a document (zero-based).

class lsprotocol.types.PositionEncodingKind(value)

A set of predefined position encoding kinds.

LSP v3.17.0

Utf16 = 'utf-16'

Character offsets count UTF-16 code units.

This is the default and must always be supported by servers

Utf32 = 'utf-32'

Character offsets count UTF-32 code units.

Implementation note: these are the same as Unicode codepoints, so this PositionEncodingKind may also be used for an encoding-agnostic representation of character offsets.

Utf8 = 'utf-8'

Character offsets count UTF-8 code units (e.g. bytes).

class lsprotocol.types.PrepareRenameDefaultBehavior(default_behavior)

LSP v3.18.0

Parameters:

default_behavior (bool)

default_behavior: bool
class lsprotocol.types.PrepareRenameParams(text_document, position, work_done_token=None)
Parameters:
position: Position

The position inside the text document.

text_document: TextDocumentIdentifier

The text document.

work_done_token: int | str | None

An optional token that a server can use to report work done progress.

class lsprotocol.types.PrepareRenamePlaceholder(range, placeholder)

LSP v3.18.0

Parameters:
placeholder: str
range: Range
class lsprotocol.types.PrepareRenameRequest(id, params, method='textDocument/prepareRename', jsonrpc='2.0')

A request to test and perform the setup necessary for a rename.

LSP v3.16 - support for default behavior

Parameters:
id: int | str

The request id.

jsonrpc: str
method: Literal['textDocument/prepareRename']

The method to be invoked.

params: PrepareRenameParams
class lsprotocol.types.PrepareRenameResponse(id, result=None, jsonrpc='2.0')
Parameters:
id: int | str | None

The request id.

jsonrpc: str
result: Range | PrepareRenamePlaceholder | PrepareRenameDefaultBehavior | None
class lsprotocol.types.PrepareSupportDefaultBehavior(value)
Identifier = 1

The client’s default behavior is to select the identifier according the to language’s syntax rule.

class lsprotocol.types.PreviousResultId(uri, value)

A previous result id in a workspace pull request.

LSP v3.17.0

Parameters:
uri: str

The URI for which the client knowns a result id.

value: str

The value of the previous result id.

class lsprotocol.types.ProgressNotification(params, method='$/progress', jsonrpc='2.0')
Parameters:
jsonrpc: str
method: Literal['$/progress']

The method to be invoked.

params: ProgressParams
class lsprotocol.types.ProgressParams(token, value)
Parameters:
token: int | str

The progress token provided by the client or server.

value: Any | None

The progress data.

class lsprotocol.types.PublishDiagnosticsClientCapabilities(version_support=None, related_information=None, tag_support=None, code_description_support=None, data_support=None)

The publish diagnostic client capabilities.

Parameters:
code_description_support: bool | None

Client supports a codeDescription property

LSP v3.16.0

data_support: bool | None

Whether code action supports the data property which is preserved between a textDocument/publishDiagnostics and textDocument/codeAction request.

LSP v3.16.0

related_information: bool | None

Whether the clients accepts diagnostics with related information.

tag_support: ClientDiagnosticsTagOptions | None

Client supports the tag property to provide meta data about a diagnostic. Clients supporting tags have to handle unknown tags gracefully.

LSP v3.15.0

version_support: bool | None

Whether the client interprets the version property of the textDocument/publishDiagnostics notification’s parameter.

LSP v3.15.0

class lsprotocol.types.PublishDiagnosticsNotification(params, method='textDocument/publishDiagnostics', jsonrpc='2.0')

Diagnostics notification are sent from the server to the client to signal results of validation runs.

Parameters:
jsonrpc: str
method: Literal['textDocument/publishDiagnostics']

The method to be invoked.

params: PublishDiagnosticsParams
class lsprotocol.types.PublishDiagnosticsParams(uri, diagnostics, version=None)

The publish diagnostic notification’s parameters.

Parameters:
diagnostics: Sequence[Diagnostic]

An array of diagnostic information items.

uri: str

The URI for which diagnostic information is reported.

version: int | None

Optional the version number of the document the diagnostics are published for.

LSP v3.15.0

class lsprotocol.types.Range(start, end)

A range in a text document expressed as (zero-based) start and end positions.

If you want to specify a range that contains a line including the line ending character(s) then use an end position denoting the start of the next line. For example:

{
start: { line: 5, character: 23 }
end : { line 6, character : 0 }
}
Parameters:
end: Position

The range’s end position.

start: Position

The range’s start position.

class lsprotocol.types.ReferenceClientCapabilities(dynamic_registration=None)

Client Capabilities for a ReferencesRequest.

Parameters:

dynamic_registration (bool | None)

dynamic_registration: bool | None

Whether references supports dynamic registration.

class lsprotocol.types.ReferenceContext(include_declaration)

Value-object that contains additional information when requesting references.

Parameters:

include_declaration (bool)

include_declaration: bool

Include the declaration of the current symbol.

class lsprotocol.types.ReferenceOptions(work_done_progress=None)

Reference options.

Parameters:

work_done_progress (bool | None)

work_done_progress: bool | None
class lsprotocol.types.ReferenceParams(context, text_document, position, work_done_token=None, partial_result_token=None)

Parameters for a ReferencesRequest.

Parameters:
context: ReferenceContext
partial_result_token: int | str | None

An optional token that a server can use to report partial results (e.g. streaming) to the client.

position: Position

The position inside the text document.

text_document: TextDocumentIdentifier

The text document.

work_done_token: int | str | None

An optional token that a server can use to report work done progress.

class lsprotocol.types.ReferenceRegistrationOptions(document_selector=None, work_done_progress=None)

Registration options for a ReferencesRequest.

Parameters:
document_selector: Sequence[TextDocumentFilterLanguage | TextDocumentFilterScheme | TextDocumentFilterPattern | NotebookCellTextDocumentFilter] | None

A document selector to identify the scope of the registration. If set to null the document selector provided on the client side will be used.

work_done_progress: bool | None
class lsprotocol.types.ReferencesRequest(id, params, method='textDocument/references', jsonrpc='2.0')

A request to resolve project-wide references for the symbol denoted by the given text document position. The request’s parameter is of type ReferenceParams the response is of type Location Location[] or a Thenable that resolves to such.

Parameters:
id: int | str

The request id.

jsonrpc: str
method: Literal['textDocument/references']

The method to be invoked.

params: ReferenceParams
class lsprotocol.types.ReferencesResponse(id, result=None, jsonrpc='2.0')
Parameters:
id: int | str | None

The request id.

jsonrpc: str
result: Sequence[Location] | None
class lsprotocol.types.Registration(id, method, register_options=None)

General parameters to register for a notification or to register a provider.

Parameters:
  • id (str)

  • method (str)

  • register_options (Any | None)

id: str

The id used to register the request. The id can be used to deregister the request again.

method: str

The method / capability to register for.

register_options: Any | None

Options necessary for the registration.

class lsprotocol.types.RegistrationParams(registrations)
Parameters:

registrations (Sequence[Registration])

registrations: Sequence[Registration]
class lsprotocol.types.RegistrationRequest(id, params, method='client/registerCapability', jsonrpc='2.0')

The client/registerCapability request is sent from the server to the client to register a new capability handler on the client side.

Parameters:
id: int | str

The request id.

jsonrpc: str
method: Literal['client/registerCapability']

The method to be invoked.

params: RegistrationParams
class lsprotocol.types.RegistrationResponse(id, result=None, jsonrpc='2.0')
Parameters:
  • id (int | str | None)

  • result (None)

  • jsonrpc (str)

id: int | str | None

The request id.

jsonrpc: str
result: None
class lsprotocol.types.RegularExpressionsClientCapabilities(engine, version=None)

Client capabilities specific to regular expressions.

LSP v3.16.0

Parameters:
  • engine (str)

  • version (str | None)

engine: str

The engine’s name.

version: str | None

The engine’s version.

class lsprotocol.types.RelatedFullDocumentDiagnosticReport(items, related_documents=None, kind='full', result_id=None)

A full diagnostic report with a set of related documents.

LSP v3.17.0

Parameters:
items: Sequence[Diagnostic]

The actual items.

kind: str

A full document diagnostic report.

related_documents: Mapping[str, FullDocumentDiagnosticReport | UnchangedDocumentDiagnosticReport] | None

Diagnostics of related documents. This information is useful in programming languages where code in a file A can generate diagnostics in a file B which A depends on. An example of such a language is C/C++ where marco definitions in a file a.cpp and result in errors in a header file b.hpp.

LSP v3.17.0

result_id: str | None

An optional result id. If provided it will be sent on the next diagnostic request for the same document.

class lsprotocol.types.RelatedUnchangedDocumentDiagnosticReport(result_id, related_documents=None, kind='unchanged')

An unchanged diagnostic report with a set of related documents.

LSP v3.17.0

Parameters:
kind: str

A document diagnostic report indicating no changes to the last result. A server can only return unchanged if result ids are provided.

related_documents: Mapping[str, FullDocumentDiagnosticReport | UnchangedDocumentDiagnosticReport] | None

Diagnostics of related documents. This information is useful in programming languages where code in a file A can generate diagnostics in a file B which A depends on. An example of such a language is C/C++ where marco definitions in a file a.cpp and result in errors in a header file b.hpp.

LSP v3.17.0

result_id: str

A result id which will be sent on the next diagnostic request for the same document.

class lsprotocol.types.RelativePattern(base_uri, pattern)

A relative pattern is a helper to construct glob patterns that are matched relatively to a base URI. The common value for a baseUri is a workspace folder root, but it can be another absolute URI as well.

LSP v3.17.0

Parameters:
base_uri: WorkspaceFolder | str

A workspace folder or a base URI to which this pattern will be matched against relatively.

pattern: str

The actual glob pattern;

class lsprotocol.types.RenameClientCapabilities(dynamic_registration=None, prepare_support=None, prepare_support_default_behavior=None, honors_change_annotations=None)
Parameters:
dynamic_registration: bool | None

Whether rename supports dynamic registration.

honors_change_annotations: bool | None

Whether the client honors the change annotations in text edits and resource operations returned via the rename request’s workspace edit by for example presenting the workspace edit in the user interface and asking for confirmation.

LSP v3.16.0

prepare_support: bool | None

Client supports testing for validity of rename operations before execution.

LSP v3.12.0

prepare_support_default_behavior: PrepareSupportDefaultBehavior | None

Client supports the default behavior result.

The value indicates the default behavior used by the client.

LSP v3.16.0

class lsprotocol.types.RenameFile(old_uri, new_uri, kind='rename', options=None, annotation_id=None)

Rename file operation

Parameters:
annotation_id: str | None

An optional annotation identifier describing the operation.

LSP v3.16.0

kind: str

A rename

new_uri: str

The new location.

old_uri: str

The old (existing) location.

options: RenameFileOptions | None

Rename options.

class lsprotocol.types.RenameFileOptions(overwrite=None, ignore_if_exists=None)

Rename file options

Parameters:
  • overwrite (bool | None)

  • ignore_if_exists (bool | None)

ignore_if_exists: bool | None

Ignores if target exists.

overwrite: bool | None

Overwrite target if existing. Overwrite wins over ignoreIfExists

class lsprotocol.types.RenameFilesParams(files)

The parameters sent in notifications/requests for user-initiated renames of files.

LSP v3.16.0

Parameters:

files (Sequence[FileRename])

files: Sequence[FileRename]

An array of all files/folders renamed in this operation. When a folder is renamed, only the folder will be included, and not its children.

class lsprotocol.types.RenameOptions(prepare_provider=None, work_done_progress=None)

Provider options for a RenameRequest.

Parameters:
  • prepare_provider (bool | None)

  • work_done_progress (bool | None)

prepare_provider: bool | None

Renames should be checked and tested before being executed.

@since version 3.12.0

work_done_progress: bool | None
class lsprotocol.types.RenameParams(text_document, position, new_name, work_done_token=None)

The parameters of a RenameRequest.

Parameters:
new_name: str

The new name of the symbol. If the given name is not valid the request must return a ResponseError with an appropriate message set.

position: Position

The position at which this request was sent.

text_document: TextDocumentIdentifier

The document to rename.

work_done_token: int | str | None

An optional token that a server can use to report work done progress.

class lsprotocol.types.RenameRegistrationOptions(document_selector=None, prepare_provider=None, work_done_progress=None)

Registration options for a RenameRequest.

Parameters:
document_selector: Sequence[TextDocumentFilterLanguage | TextDocumentFilterScheme | TextDocumentFilterPattern | NotebookCellTextDocumentFilter] | None

A document selector to identify the scope of the registration. If set to null the document selector provided on the client side will be used.

prepare_provider: bool | None

Renames should be checked and tested before being executed.

@since version 3.12.0

work_done_progress: bool | None
class lsprotocol.types.RenameRequest(id, params, method='textDocument/rename', jsonrpc='2.0')

A request to rename a symbol.

Parameters:
id: int | str

The request id.

jsonrpc: str
method: Literal['textDocument/rename']

The method to be invoked.

params: RenameParams
class lsprotocol.types.RenameResponse(id, result=None, jsonrpc='2.0')
Parameters:
id: int | str | None

The request id.

jsonrpc: str
result: WorkspaceEdit | None
class lsprotocol.types.ResourceOperation(kind, annotation_id=None)

A generic resource operation.

Parameters:
  • kind (str)

  • annotation_id (str | None)

annotation_id: str | None

An optional annotation identifier describing the operation.

LSP v3.16.0

kind: str

The resource operation kind.

class lsprotocol.types.ResourceOperationKind(value)
Create = 'create'

Supports creating new files and folders.

Delete = 'delete'

Supports deleting existing files and folders.

Rename = 'rename'

Supports renaming existing files and folders.

class lsprotocol.types.ResponseError(code, message, data=None)
Parameters:
code: int

A number indicating the error type that occurred.

data: Any | None

A primitive or structured value that contains additional information about the error. Can be omitted.

message: str

A string providing a short description of the error.

class lsprotocol.types.ResponseErrorMessage(id=None, error=None, jsonrpc='2.0')
Parameters:
error: ResponseError | None

The error object in case a request fails.

id: int | str | None

The request id where the error occurred.

jsonrpc: str
class lsprotocol.types.SaveOptions(include_text=None)

Save options.

Parameters:

include_text (bool | None)

include_text: bool | None

The client is supposed to include the content on save.

class lsprotocol.types.SelectedCompletionInfo(range, text)

Describes the currently selected completion item.

LSP v3.18.0 @proposed

Parameters:
range: Range

The range that will be replaced if this completion item is accepted.

text: str

The text the range will be replaced with if this completion is accepted.

class lsprotocol.types.SelectionRange(range, parent=None)

A selection range represents a part of a selection hierarchy. A selection range may have a parent selection range that contains it.

Parameters:
parent: SelectionRange | None

The parent selection range containing this range. Therefore parent.range must contain this.range.

range: Range

The Range range of this selection range.

class lsprotocol.types.SelectionRangeClientCapabilities(dynamic_registration=None)
Parameters:

dynamic_registration (bool | None)

dynamic_registration: bool | None

Whether implementation supports dynamic registration for selection range providers. If this is set to true the client supports the new SelectionRangeRegistrationOptions return value for the corresponding server capability as well.

class lsprotocol.types.SelectionRangeOptions(work_done_progress=None)
Parameters:

work_done_progress (bool | None)

work_done_progress: bool | None
class lsprotocol.types.SelectionRangeParams(text_document, positions, work_done_token=None, partial_result_token=None)

A parameter literal used in selection range requests.

Parameters:
partial_result_token: int | str | None

An optional token that a server can use to report partial results (e.g. streaming) to the client.

positions: Sequence[Position]

The positions inside the text document.

text_document: TextDocumentIdentifier

The text document.

work_done_token: int | str | None

An optional token that a server can use to report work done progress.

class lsprotocol.types.SelectionRangeRegistrationOptions(work_done_progress=None, document_selector=None, id=None)
Parameters:
document_selector: Sequence[TextDocumentFilterLanguage | TextDocumentFilterScheme | TextDocumentFilterPattern | NotebookCellTextDocumentFilter] | None

A document selector to identify the scope of the registration. If set to null the document selector provided on the client side will be used.

id: str | None

The id used to register the request. The id can be used to deregister the request again. See also Registration#id.

work_done_progress: bool | None
class lsprotocol.types.SelectionRangeRequest(id, params, method='textDocument/selectionRange', jsonrpc='2.0')

A request to provide selection ranges in a document. The request’s parameter is of type SelectionRangeParams, the response is of type SelectionRange SelectionRange[] or a Thenable that resolves to such.

Parameters:
id: int | str

The request id.

jsonrpc: str
method: Literal['textDocument/selectionRange']

The method to be invoked.

params: SelectionRangeParams
class lsprotocol.types.SelectionRangeResponse(id, result=None, jsonrpc='2.0')
Parameters:
id: int | str | None

The request id.

jsonrpc: str
result: Sequence[SelectionRange] | None
class lsprotocol.types.SemanticTokenModifiers(value)

A set of predefined token modifiers. This set is not fixed an clients can specify additional token types via the corresponding client capabilities.

LSP v3.16.0

Abstract = 'abstract'
Async = 'async'
Declaration = 'declaration'
DefaultLibrary = 'defaultLibrary'
Definition = 'definition'
Deprecated = 'deprecated'
Documentation = 'documentation'
Modification = 'modification'
Readonly = 'readonly'
Static = 'static'
class lsprotocol.types.SemanticTokenTypes(value)

A set of predefined token types. This set is not fixed an clients can specify additional token types via the corresponding client capabilities.

LSP v3.16.0

Class = 'class'
Comment = 'comment'
Decorator = 'decorator'

LSP v3.17.0

Enum = 'enum'
EnumMember = 'enumMember'
Event = 'event'
Function = 'function'
Interface = 'interface'
Keyword = 'keyword'
Label = 'label'

LSP v3.18.0

Macro = 'macro'
Method = 'method'
Modifier = 'modifier'
Namespace = 'namespace'
Number = 'number'
Operator = 'operator'
Parameter = 'parameter'
Property = 'property'
Regexp = 'regexp'
String = 'string'
Struct = 'struct'
Type = 'type'

Represents a generic type. Acts as a fallback for types which can’t be mapped to a specific type like class or enum.

TypeParameter = 'typeParameter'
Variable = 'variable'
class lsprotocol.types.SemanticTokens(data, result_id=None)

LSP v3.16.0

Parameters:
data: Sequence[int]

The actual tokens.

result_id: str | None

An optional result id. If provided and clients support delta updating the client will include the result id in the next semantic token request. A server can then instead of computing all semantic tokens again simply send a delta.

class lsprotocol.types.SemanticTokensClientCapabilities(requests, token_types, token_modifiers, formats, dynamic_registration=None, overlapping_token_support=None, multiline_token_support=None, server_cancel_support=None, augments_syntax_tokens=None)

LSP v3.16.0

Parameters:
augments_syntax_tokens: bool | None

Whether the client uses semantic tokens to augment existing syntax tokens. If set to true client side created syntax tokens and semantic tokens are both used for colorization. If set to false the client only uses the returned semantic tokens for colorization.

If the value is undefined then the client behavior is not specified.

LSP v3.17.0

dynamic_registration: bool | None

Whether implementation supports dynamic registration. If this is set to true the client supports the new (TextDocumentRegistrationOptions & StaticRegistrationOptions) return value for the corresponding server capability as well.

formats: Sequence[TokenFormat]

The token formats the clients supports.

multiline_token_support: bool | None

Whether the client supports tokens that can span multiple lines.

overlapping_token_support: bool | None

Whether the client supports tokens that can overlap each other.

requests: ClientSemanticTokensRequestOptions

Which requests the client supports and might send to the server depending on the server’s capability. Please note that clients might not show semantic tokens or degrade some of the user experience if a range or full request is advertised by the client but not provided by the server. If for example the client capability requests.full and request.range are both set to true but the server only provides a range provider the client might not render a minimap correctly or might even decide to not show any semantic tokens at all.

server_cancel_support: bool | None

Whether the client allows the server to actively cancel a semantic token request, e.g. supports returning LSPErrorCodes.ServerCancelled. If a server does the client needs to retrigger the request.

LSP v3.17.0

token_modifiers: Sequence[str]

The token modifiers that the client supports.

token_types: Sequence[str]

The token types that the client supports.

class lsprotocol.types.SemanticTokensDelta(edits, result_id=None)

LSP v3.16.0

Parameters:
edits: Sequence[SemanticTokensEdit]

The semantic token edits to transform a previous result into a new result.

result_id: str | None
class lsprotocol.types.SemanticTokensDeltaParams(text_document, previous_result_id, work_done_token=None, partial_result_token=None)

LSP v3.16.0

Parameters:
partial_result_token: int | str | None

An optional token that a server can use to report partial results (e.g. streaming) to the client.

previous_result_id: str

The result id of a previous response. The result Id can either point to a full response or a delta response depending on what was received last.

text_document: TextDocumentIdentifier

The text document.

work_done_token: int | str | None

An optional token that a server can use to report work done progress.

class lsprotocol.types.SemanticTokensDeltaPartialResult(edits)

LSP v3.16.0

Parameters:

edits (Sequence[SemanticTokensEdit])

edits: Sequence[SemanticTokensEdit]
class lsprotocol.types.SemanticTokensDeltaRequest(id, params, method='textDocument/semanticTokens/full/delta', jsonrpc='2.0')

LSP v3.16.0

Parameters:
id: int | str

The request id.

jsonrpc: str
method: Literal['textDocument/semanticTokens/full/delta']

The method to be invoked.

params: SemanticTokensDeltaParams
class lsprotocol.types.SemanticTokensDeltaResponse(id, result=None, jsonrpc='2.0')
Parameters:
id: int | str | None

The request id.

jsonrpc: str
result: SemanticTokens | SemanticTokensDelta | None
class lsprotocol.types.SemanticTokensEdit(start, delete_count, data=None)

LSP v3.16.0

Parameters:
data: Sequence[int] | None

The elements to insert.

delete_count: int

The count of elements to remove.

start: int

The start offset of the edit.

class lsprotocol.types.SemanticTokensFullDelta(delta=None)

Semantic tokens options to support deltas for full documents

LSP v3.18.0

Parameters:

delta (bool | None)

delta: bool | None

The server supports deltas for full documents.

class lsprotocol.types.SemanticTokensLegend(token_types, token_modifiers)

LSP v3.16.0

Parameters:
token_modifiers: Sequence[str]

The token modifiers a server uses.

token_types: Sequence[str]

The token types a server uses.

class lsprotocol.types.SemanticTokensOptions(legend, range=None, full=None, work_done_progress=None)

LSP v3.16.0

Parameters:
full: bool | SemanticTokensFullDelta | None

Server supports providing semantic tokens for a full document.

legend: SemanticTokensLegend

The legend used by the server

range: bool | Any | None

Server supports providing semantic tokens for a specific range of a document.

work_done_progress: bool | None
class lsprotocol.types.SemanticTokensParams(text_document, work_done_token=None, partial_result_token=None)

LSP v3.16.0

Parameters:
partial_result_token: int | str | None

An optional token that a server can use to report partial results (e.g. streaming) to the client.

text_document: TextDocumentIdentifier

The text document.

work_done_token: int | str | None

An optional token that a server can use to report work done progress.

class lsprotocol.types.SemanticTokensPartialResult(data)

LSP v3.16.0

Parameters:

data (Sequence[int])

data: Sequence[int]
class lsprotocol.types.SemanticTokensRangeParams(text_document, range, work_done_token=None, partial_result_token=None)

LSP v3.16.0

Parameters:
partial_result_token: int | str | None

An optional token that a server can use to report partial results (e.g. streaming) to the client.

range: Range

The range the semantic tokens are requested for.

text_document: TextDocumentIdentifier

The text document.

work_done_token: int | str | None

An optional token that a server can use to report work done progress.

class lsprotocol.types.SemanticTokensRangeRequest(id, params, method='textDocument/semanticTokens/range', jsonrpc='2.0')

LSP v3.16.0

Parameters:
id: int | str

The request id.

jsonrpc: str
method: Literal['textDocument/semanticTokens/range']

The method to be invoked.

params: SemanticTokensRangeParams
class lsprotocol.types.SemanticTokensRangeResponse(id, result=None, jsonrpc='2.0')
Parameters:
id: int | str | None

The request id.

jsonrpc: str
result: SemanticTokens | None
class lsprotocol.types.SemanticTokensRefreshRequest(id, params=None, method='workspace/semanticTokens/refresh', jsonrpc='2.0')

LSP v3.16.0

Parameters:
  • id (int | str)

  • params (None)

  • method (Literal['workspace/semanticTokens/refresh'])

  • jsonrpc (str)

id: int | str

The request id.

jsonrpc: str
method: Literal['workspace/semanticTokens/refresh']

The method to be invoked.

params: None
class lsprotocol.types.SemanticTokensRefreshResponse(id, result=None, jsonrpc='2.0')
Parameters:
  • id (int | str | None)

  • result (None)

  • jsonrpc (str)

id: int | str | None

The request id.

jsonrpc: str
result: None
class lsprotocol.types.SemanticTokensRegistrationOptions(legend, document_selector=None, range=None, full=None, work_done_progress=None, id=None)

LSP v3.16.0

Parameters:
document_selector: Sequence[TextDocumentFilterLanguage | TextDocumentFilterScheme | TextDocumentFilterPattern | NotebookCellTextDocumentFilter] | None

A document selector to identify the scope of the registration. If set to null the document selector provided on the client side will be used.

full: bool | SemanticTokensFullDelta | None

Server supports providing semantic tokens for a full document.

id: str | None

The id used to register the request. The id can be used to deregister the request again. See also Registration#id.

legend: SemanticTokensLegend

The legend used by the server

range: bool | Any | None

Server supports providing semantic tokens for a specific range of a document.

work_done_progress: bool | None
class lsprotocol.types.SemanticTokensRequest(id, params, method='textDocument/semanticTokens/full', jsonrpc='2.0')

LSP v3.16.0

Parameters:
id: int | str

The request id.

jsonrpc: str
method: Literal['textDocument/semanticTokens/full']

The method to be invoked.

params: SemanticTokensParams
class lsprotocol.types.SemanticTokensResponse(id, result=None, jsonrpc='2.0')
Parameters:
id: int | str | None

The request id.

jsonrpc: str
result: SemanticTokens | None
class lsprotocol.types.SemanticTokensWorkspaceClientCapabilities(refresh_support=None)

LSP v3.16.0

Parameters:

refresh_support (bool | None)

refresh_support: bool | None

Whether the client implementation supports a refresh request sent from the server to the client.

Note that this event is global and will force the client to refresh all semantic tokens currently shown. It should be used with absolute care and is useful for situation where a server for example detects a project wide change that requires such a calculation.

class lsprotocol.types.ServerCapabilities(position_encoding=None, text_document_sync=None, notebook_document_sync=None, completion_provider=None, hover_provider=None, signature_help_provider=None, declaration_provider=None, definition_provider=None, type_definition_provider=None, implementation_provider=None, references_provider=None, document_highlight_provider=None, document_symbol_provider=None, code_action_provider=None, code_lens_provider=None, document_link_provider=None, color_provider=None, workspace_symbol_provider=None, document_formatting_provider=None, document_range_formatting_provider=None, document_on_type_formatting_provider=None, rename_provider=None, folding_range_provider=None, selection_range_provider=None, execute_command_provider=None, call_hierarchy_provider=None, linked_editing_range_provider=None, semantic_tokens_provider=None, moniker_provider=None, type_hierarchy_provider=None, inline_value_provider=None, inlay_hint_provider=None, diagnostic_provider=None, inline_completion_provider=None, workspace=None, experimental=None)

Defines the capabilities provided by a language server.

Parameters:
call_hierarchy_provider: bool | CallHierarchyOptions | CallHierarchyRegistrationOptions | None

The server provides call hierarchy support.

LSP v3.16.0

code_action_provider: bool | CodeActionOptions | None

The server provides code actions. CodeActionOptions may only be specified if the client states that it supports codeActionLiteralSupport in its initial initialize request.

code_lens_provider: CodeLensOptions | None

The server provides code lens.

color_provider: bool | DocumentColorOptions | DocumentColorRegistrationOptions | None

The server provides color provider support.

completion_provider: CompletionOptions | None

The server provides completion support.

declaration_provider: bool | DeclarationOptions | DeclarationRegistrationOptions | None

The server provides Goto Declaration support.

definition_provider: bool | DefinitionOptions | None

The server provides goto definition support.

diagnostic_provider: DiagnosticOptions | DiagnosticRegistrationOptions | None

The server has support for pull model diagnostics.

LSP v3.17.0

document_formatting_provider: bool | DocumentFormattingOptions | None

The server provides document formatting.

document_highlight_provider: bool | DocumentHighlightOptions | None

The server provides document highlight support.

The server provides document link support.

document_on_type_formatting_provider: DocumentOnTypeFormattingOptions | None

The server provides document formatting on typing.

document_range_formatting_provider: bool | DocumentRangeFormattingOptions | None

The server provides document range formatting.

document_symbol_provider: bool | DocumentSymbolOptions | None

The server provides document symbol support.

execute_command_provider: ExecuteCommandOptions | None

The server provides execute command support.

experimental: Any | None

Experimental server capabilities.

folding_range_provider: bool | FoldingRangeOptions | FoldingRangeRegistrationOptions | None

The server provides folding provider support.

hover_provider: bool | HoverOptions | None

The server provides hover support.

implementation_provider: bool | ImplementationOptions | ImplementationRegistrationOptions | None

The server provides Goto Implementation support.

inlay_hint_provider: bool | InlayHintOptions | InlayHintRegistrationOptions | None

The server provides inlay hints.

LSP v3.17.0

inline_completion_provider: bool | InlineCompletionOptions | None

Inline completion options used during static registration.

LSP v3.18.0 @proposed

inline_value_provider: bool | InlineValueOptions | InlineValueRegistrationOptions | None

The server provides inline values.

LSP v3.17.0

linked_editing_range_provider: bool | LinkedEditingRangeOptions | LinkedEditingRangeRegistrationOptions | None

The server provides linked editing range support.

LSP v3.16.0

moniker_provider: bool | MonikerOptions | MonikerRegistrationOptions | None

The server provides moniker support.

LSP v3.16.0

notebook_document_sync: NotebookDocumentSyncOptions | NotebookDocumentSyncRegistrationOptions | None

Defines how notebook documents are synced.

LSP v3.17.0

position_encoding: PositionEncodingKind | str | None

The position encoding the server picked from the encodings offered by the client via the client capability general.positionEncodings .

If the client didn’t provide any position encodings the only valid value that a server can return is ‘utf-16’.

If omitted it defaults to ‘utf-16’.

LSP v3.17.0

references_provider: bool | ReferenceOptions | None

The server provides find references support.

rename_provider: bool | RenameOptions | None

The server provides rename support. RenameOptions may only be specified if the client states that it supports prepareSupport in its initial initialize request.

selection_range_provider: bool | SelectionRangeOptions | SelectionRangeRegistrationOptions | None

The server provides selection range support.

semantic_tokens_provider: SemanticTokensOptions | SemanticTokensRegistrationOptions | None

The server provides semantic tokens support.

LSP v3.16.0

signature_help_provider: SignatureHelpOptions | None

The server provides signature help support.

text_document_sync: TextDocumentSyncOptions | TextDocumentSyncKind | None

Defines how text documents are synced. Is either a detailed structure defining each notification or for backwards compatibility the TextDocumentSyncKind number.

type_definition_provider: bool | TypeDefinitionOptions | TypeDefinitionRegistrationOptions | None

The server provides Goto Type Definition support.

type_hierarchy_provider: bool | TypeHierarchyOptions | TypeHierarchyRegistrationOptions | None

The server provides type hierarchy support.

LSP v3.17.0

workspace: WorkspaceOptions | None

Workspace specific server capabilities.

workspace_symbol_provider: bool | WorkspaceSymbolOptions | None

The server provides workspace symbol support.

class lsprotocol.types.ServerCompletionItemOptions(label_details_support=None)

LSP v3.18.0

Parameters:

label_details_support (bool | None)

label_details_support: bool | None

The server has support for completion item label details (see also CompletionItemLabelDetails ) when receiving a completion item in a resolve call.

LSP v3.17.0

class lsprotocol.types.ServerInfo(name, version=None)

Information about the server

LSP v3.15.0 LSP v3.18.0 ServerInfo type name added.

Parameters:
  • name (str)

  • version (str | None)

name: str

The name of the server as defined by the server.

version: str | None

The server’s version as defined by the server.

class lsprotocol.types.SetTraceNotification(params, method='$/setTrace', jsonrpc='2.0')
Parameters:
jsonrpc: str
method: Literal['$/setTrace']

The method to be invoked.

params: SetTraceParams
class lsprotocol.types.SetTraceParams(value)
Parameters:

value (TraceValue)

value: TraceValue
class lsprotocol.types.ShowDocumentClientCapabilities(support)

Client capabilities for the showDocument request.

LSP v3.16.0

Parameters:

support (bool)

support: bool

The client has support for the showDocument request.

class lsprotocol.types.ShowDocumentParams(uri, external=None, take_focus=None, selection=None)

Params to show a resource in the UI.

LSP v3.16.0

Parameters:
  • uri (str)

  • external (bool | None)

  • take_focus (bool | None)

  • selection (Range | None)

external: bool | None

Indicates to show the resource in an external program. To show, for example, https://code.visualstudio.com/ in the default WEB browser set external to true.

selection: Range | None

An optional selection range if the document is a text document. Clients might ignore the property if an external program is started or the file is not a text file.

take_focus: bool | None

An optional property to indicate whether the editor showing the document should take focus or not. Clients might ignore this property if an external program is started.

uri: str

The uri to show.

class lsprotocol.types.ShowDocumentRequest(id, params, method='window/showDocument', jsonrpc='2.0')

A request to show a document. This request might open an external program depending on the value of the URI to open. For example a request to open https://code.visualstudio.com/ will very likely open the URI in a WEB browser.

LSP v3.16.0

Parameters:
id: int | str

The request id.

jsonrpc: str
method: Literal['window/showDocument']

The method to be invoked.

params: ShowDocumentParams
class lsprotocol.types.ShowDocumentResponse(id, result=None, jsonrpc='2.0')
Parameters:
id: int | str | None

The request id.

jsonrpc: str
result: ShowDocumentResult
class lsprotocol.types.ShowDocumentResult(success)

The result of a showDocument request.

LSP v3.16.0

Parameters:

success (bool)

success: bool

A boolean indicating if the show was successful.

class lsprotocol.types.ShowMessageNotification(params, method='window/showMessage', jsonrpc='2.0')

The show message notification is sent from a server to a client to ask the client to display a particular message in the user interface.

Parameters:
jsonrpc: str
method: Literal['window/showMessage']

The method to be invoked.

params: ShowMessageParams
class lsprotocol.types.ShowMessageParams(type, message)

The parameters of a notification message.

Parameters:
message: str

The actual message.

type: MessageType

The message type. See MessageType

class lsprotocol.types.ShowMessageRequest(id, params, method='window/showMessageRequest', jsonrpc='2.0')

The show message request is sent from the server to the client to show a message and a set of options actions to the user.

Parameters:
id: int | str

The request id.

jsonrpc: str
method: Literal['window/showMessageRequest']

The method to be invoked.

params: ShowMessageRequestParams
class lsprotocol.types.ShowMessageRequestClientCapabilities(message_action_item=None)

Show message request client capabilities

Parameters:

message_action_item (ClientShowMessageActionItemOptions | None)

message_action_item: ClientShowMessageActionItemOptions | None

Capabilities specific to the MessageActionItem type.

class lsprotocol.types.ShowMessageRequestParams(type, message, actions=None)
Parameters:
actions: Sequence[MessageActionItem] | None

The message action items to present.

message: str

The actual message.

type: MessageType

The message type. See MessageType

class lsprotocol.types.ShowMessageResponse(id, result=None, jsonrpc='2.0')
Parameters:
id: int | str | None

The request id.

jsonrpc: str
result: MessageActionItem | None
class lsprotocol.types.ShutdownRequest(id, params=None, method='shutdown', jsonrpc='2.0')

A shutdown request is sent from the client to the server. It is sent once when the client decides to shutdown the server. The only notification that is sent after a shutdown request is the exit event.

Parameters:
id: int | str

The request id.

jsonrpc: str
method: Literal['shutdown']

The method to be invoked.

params: None
class lsprotocol.types.ShutdownResponse(id, result=None, jsonrpc='2.0')
Parameters:
  • id (int | str | None)

  • result (None)

  • jsonrpc (str)

id: int | str | None

The request id.

jsonrpc: str
result: None
class lsprotocol.types.SignatureHelp(signatures, active_signature=None, active_parameter=None)

Signature help represents the signature of something callable. There can be multiple signature but only one active and only one active parameter.

Parameters:
active_parameter: int | None

The active parameter of the active signature.

If null , no parameter of the signature is active (for example a named argument that does not match any declared parameters). This is only valid if the client specifies the client capability textDocument.signatureHelp.noActiveParameterSupport === true

If omitted or the value lies outside the range of signatures[activeSignature].parameters defaults to 0 if the active signature has parameters.

If the active signature has no parameters it is ignored.

In future version of the protocol this property might become mandatory (but still nullable) to better express the active parameter if the active signature does have any.

active_signature: int | None

The active signature. If omitted or the value lies outside the range of signatures the value defaults to zero or is ignored if the SignatureHelp has no signatures.

Whenever possible implementors should make an active decision about the active signature and shouldn’t rely on a default value.

In future version of the protocol this property might become mandatory to better express this.

signatures: Sequence[SignatureInformation]

One or more signatures.

class lsprotocol.types.SignatureHelpClientCapabilities(dynamic_registration=None, signature_information=None, context_support=None)

Client Capabilities for a SignatureHelpRequest.

Parameters:
context_support: bool | None

The client supports to send additional context information for a textDocument/signatureHelp request. A client that opts into contextSupport will also support the retriggerCharacters on SignatureHelpOptions .

LSP v3.15.0

dynamic_registration: bool | None

Whether signature help supports dynamic registration.

signature_information: ClientSignatureInformationOptions | None

The client supports the following SignatureInformation specific properties.

class lsprotocol.types.SignatureHelpContext(trigger_kind, is_retrigger, trigger_character=None, active_signature_help=None)

Additional information about the context in which a signature help request was triggered.

LSP v3.15.0

Parameters:
active_signature_help: SignatureHelp | None

The currently active SignatureHelp .

The activeSignatureHelp has its SignatureHelp.activeSignature field updated based on the user navigating through available signatures.

is_retrigger: bool

true if signature help was already showing when it was triggered.

Retriggers occurs when the signature help is already active and can be caused by actions such as typing a trigger character, a cursor move, or document content changes.

trigger_character: str | None

Character that caused signature help to be triggered.

This is undefined when triggerKind !== SignatureHelpTriggerKind.TriggerCharacter

trigger_kind: SignatureHelpTriggerKind

Action that caused signature help to be triggered.

class lsprotocol.types.SignatureHelpOptions(trigger_characters=None, retrigger_characters=None, work_done_progress=None)

Server Capabilities for a SignatureHelpRequest.

Parameters:
retrigger_characters: Sequence[str] | None

List of characters that re-trigger signature help.

These trigger characters are only active when signature help is already showing. All trigger characters are also counted as re-trigger characters.

LSP v3.15.0

trigger_characters: Sequence[str] | None

List of characters that trigger signature help automatically.

work_done_progress: bool | None
class lsprotocol.types.SignatureHelpParams(text_document, position, context=None, work_done_token=None)

Parameters for a SignatureHelpRequest.

Parameters:
context: SignatureHelpContext | None

The signature help context. This is only available if the client specifies to send this using the client capability textDocument.signatureHelp.contextSupport === true

LSP v3.15.0

position: Position

The position inside the text document.

text_document: TextDocumentIdentifier

The text document.

work_done_token: int | str | None

An optional token that a server can use to report work done progress.

class lsprotocol.types.SignatureHelpRegistrationOptions(document_selector=None, trigger_characters=None, retrigger_characters=None, work_done_progress=None)

Registration options for a SignatureHelpRequest.

Parameters:
document_selector: Sequence[TextDocumentFilterLanguage | TextDocumentFilterScheme | TextDocumentFilterPattern | NotebookCellTextDocumentFilter] | None

A document selector to identify the scope of the registration. If set to null the document selector provided on the client side will be used.

retrigger_characters: Sequence[str] | None

List of characters that re-trigger signature help.

These trigger characters are only active when signature help is already showing. All trigger characters are also counted as re-trigger characters.

LSP v3.15.0

trigger_characters: Sequence[str] | None

List of characters that trigger signature help automatically.

work_done_progress: bool | None
class lsprotocol.types.SignatureHelpRequest(id, params, method='textDocument/signatureHelp', jsonrpc='2.0')
Parameters:
id: int | str

The request id.

jsonrpc: str
method: Literal['textDocument/signatureHelp']

The method to be invoked.

params: SignatureHelpParams
class lsprotocol.types.SignatureHelpResponse(id, result=None, jsonrpc='2.0')
Parameters:
id: int | str | None

The request id.

jsonrpc: str
result: SignatureHelp | None
class lsprotocol.types.SignatureHelpTriggerKind(value)

How a signature help was triggered.

LSP v3.15.0

ContentChange = 3

Signature help was triggered by the cursor moving or by the document content changing.

Invoked = 1

Signature help was invoked manually by the user or by a command.

TriggerCharacter = 2

Signature help was triggered by a trigger character.

class lsprotocol.types.SignatureInformation(label, documentation=None, parameters=None, active_parameter=None)

Represents the signature of something callable. A signature can have a label, like a function-name, a doc-comment, and a set of parameters.

Parameters:
active_parameter: int | None

The index of the active parameter.

If null , no parameter of the signature is active (for example a named argument that does not match any declared parameters). This is only valid if the client specifies the client capability textDocument.signatureHelp.noActiveParameterSupport === true

If provided (or null ), this is used in place of SignatureHelp.activeParameter .

LSP v3.16.0

documentation: str | MarkupContent | None

The human-readable doc-comment of this signature. Will be shown in the UI but can be omitted.

label: str

The label of this signature. Will be shown in the UI.

parameters: Sequence[ParameterInformation] | None

The parameters of this signature.

class lsprotocol.types.SnippetTextEdit(range, snippet, annotation_id=None)

An interactive text edit.

LSP v3.18.0 @proposed

Parameters:
annotation_id: str | None

The actual identifier of the snippet edit.

range: Range

The range of the text document to be manipulated.

snippet: StringValue

The snippet to be inserted.

class lsprotocol.types.StaleRequestSupportOptions(cancel, retry_on_content_modified)

LSP v3.18.0

Parameters:
cancel: bool

The client will actively cancel the request.

retry_on_content_modified: Sequence[str]

The list of requests for which the client will retry the request if it receives a response with error code ContentModified

class lsprotocol.types.StaticRegistrationOptions(id=None)

Static registration options to be returned in the initialize request.

Parameters:

id (str | None)

id: str | None

The id used to register the request. The id can be used to deregister the request again. See also Registration#id.

class lsprotocol.types.StringValue(value, kind='snippet')

A string value used as a snippet is a template which allows to insert text and to control the editor cursor when insertion happens.

A snippet can define tab stops and placeholders with $1 , $2 and ${3:foo} . $0 defines the final tab stop, it defaults to the end of the snippet. Variables are defined with $name and ${name:default value} .

LSP v3.18.0 @proposed

Parameters:
kind: str

The kind of string value.

value: str

The snippet string.

class lsprotocol.types.SymbolInformation(location, name, kind, deprecated=None, tags=None, container_name=None)

Represents information about programming constructs like variables, classes, interfaces etc.

Parameters:
container_name: str | None

The name of the symbol containing this symbol. This information is for user interface purposes (e.g. to render a qualifier in the user interface if necessary). It can’t be used to re-infer a hierarchy for the document symbols.

deprecated: bool | None

Indicates if this symbol is deprecated.

@deprecated Use tags instead

kind: SymbolKind

The kind of this symbol.

location: Location

The location of this symbol. The location’s range is used by a tool to reveal the location in the editor. If the symbol is selected in the tool the range’s start information is used to position the cursor. So the range usually spans more than the actual symbol’s name and does normally include things like visibility modifiers.

The range doesn’t have to denote a node range in the sense of an abstract syntax tree. It can therefore not be used to re-construct a hierarchy of the symbols.

name: str

The name of this symbol.

tags: Sequence[SymbolTag] | None

Tags for this symbol.

LSP v3.16.0

class lsprotocol.types.SymbolKind(value)

A symbol kind.

Array = 18
Boolean = 17
Class = 5
Constant = 14
Constructor = 9
Enum = 10
EnumMember = 22
Event = 24
Field = 8
File = 1
Function = 12
Interface = 11
Key = 20
Method = 6
Module = 2
Namespace = 3
Null = 21
Number = 16
Object = 19
Operator = 25
Package = 4
Property = 7
String = 15
Struct = 23
TypeParameter = 26
Variable = 13
class lsprotocol.types.SymbolTag(value)

Symbol tags are extra annotations that tweak the rendering of a symbol.

LSP v3.16

Deprecated = 1

Render a symbol as obsolete, usually using a strike-out.

class lsprotocol.types.TelemetryEventNotification(params, method='telemetry/event', jsonrpc='2.0')

The telemetry event notification is sent from the server to the client to ask the client to log telemetry data.

Parameters:
  • params (Any | None)

  • method (Literal['telemetry/event'])

  • jsonrpc (str)

jsonrpc: str
method: Literal['telemetry/event']

The method to be invoked.

params: Any | None
class lsprotocol.types.TextDocumentChangeRegistrationOptions(sync_kind, document_selector=None)

Describe options to be used when registered for text document change events.

Parameters:
document_selector: Sequence[TextDocumentFilterLanguage | TextDocumentFilterScheme | TextDocumentFilterPattern | NotebookCellTextDocumentFilter] | None

A document selector to identify the scope of the registration. If set to null the document selector provided on the client side will be used.

sync_kind: TextDocumentSyncKind

How documents are synced to the server.

class lsprotocol.types.TextDocumentClientCapabilities(synchronization=None, filters=None, completion=None, hover=None, signature_help=None, declaration=None, definition=None, type_definition=None, implementation=None, references=None, document_highlight=None, document_symbol=None, code_action=None, code_lens=None, document_link=None, color_provider=None, formatting=None, range_formatting=None, on_type_formatting=None, rename=None, folding_range=None, selection_range=None, publish_diagnostics=None, call_hierarchy=None, semantic_tokens=None, linked_editing_range=None, moniker=None, type_hierarchy=None, inline_value=None, inlay_hint=None, diagnostic=None, inline_completion=None)

Text document specific client capabilities.

Parameters:
call_hierarchy: CallHierarchyClientCapabilities | None

Capabilities specific to the various call hierarchy requests.

LSP v3.16.0

code_action: CodeActionClientCapabilities | None

Capabilities specific to the textDocument/codeAction request.

code_lens: CodeLensClientCapabilities | None

Capabilities specific to the textDocument/codeLens request.

color_provider: DocumentColorClientCapabilities | None

Capabilities specific to the textDocument/documentColor and the textDocument/colorPresentation request.

LSP v3.6.0

completion: CompletionClientCapabilities | None

Capabilities specific to the textDocument/completion request.

declaration: DeclarationClientCapabilities | None

Capabilities specific to the textDocument/declaration request.

LSP v3.14.0

definition: DefinitionClientCapabilities | None

Capabilities specific to the textDocument/definition request.

diagnostic: DiagnosticClientCapabilities | None

Capabilities specific to the diagnostic pull model.

LSP v3.17.0

document_highlight: DocumentHighlightClientCapabilities | None

Capabilities specific to the textDocument/documentHighlight request.

Capabilities specific to the textDocument/documentLink request.

document_symbol: DocumentSymbolClientCapabilities | None

Capabilities specific to the textDocument/documentSymbol request.

filters: TextDocumentFilterClientCapabilities | None

Defines which filters the client supports.

LSP v3.18.0

folding_range: FoldingRangeClientCapabilities | None

Capabilities specific to the textDocument/foldingRange request.

LSP v3.10.0

formatting: DocumentFormattingClientCapabilities | None

Capabilities specific to the textDocument/formatting request.

hover: HoverClientCapabilities | None

Capabilities specific to the textDocument/hover request.

implementation: ImplementationClientCapabilities | None

Capabilities specific to the textDocument/implementation request.

LSP v3.6.0

inlay_hint: InlayHintClientCapabilities | None

Capabilities specific to the textDocument/inlayHint request.

LSP v3.17.0

inline_completion: InlineCompletionClientCapabilities | None

Client capabilities specific to inline completions.

LSP v3.18.0 @proposed

inline_value: InlineValueClientCapabilities | None

Capabilities specific to the textDocument/inlineValue request.

LSP v3.17.0

linked_editing_range: LinkedEditingRangeClientCapabilities | None

Capabilities specific to the textDocument/linkedEditingRange request.

LSP v3.16.0

moniker: MonikerClientCapabilities | None

Client capabilities specific to the textDocument/moniker request.

LSP v3.16.0

on_type_formatting: DocumentOnTypeFormattingClientCapabilities | None

Capabilities specific to the textDocument/onTypeFormatting request.

publish_diagnostics: PublishDiagnosticsClientCapabilities | None

Capabilities specific to the textDocument/publishDiagnostics notification.

range_formatting: DocumentRangeFormattingClientCapabilities | None

Capabilities specific to the textDocument/rangeFormatting request.

references: ReferenceClientCapabilities | None

Capabilities specific to the textDocument/references request.

rename: RenameClientCapabilities | None

Capabilities specific to the textDocument/rename request.

selection_range: SelectionRangeClientCapabilities | None

Capabilities specific to the textDocument/selectionRange request.

LSP v3.15.0

semantic_tokens: SemanticTokensClientCapabilities | None

Capabilities specific to the various semantic token request.

LSP v3.16.0

signature_help: SignatureHelpClientCapabilities | None

Capabilities specific to the textDocument/signatureHelp request.

synchronization: TextDocumentSyncClientCapabilities | None

Defines which synchronization capabilities the client supports.

type_definition: TypeDefinitionClientCapabilities | None

Capabilities specific to the textDocument/typeDefinition request.

LSP v3.6.0

type_hierarchy: TypeHierarchyClientCapabilities | None

Capabilities specific to the various type hierarchy requests.

LSP v3.17.0

class lsprotocol.types.TextDocumentContentChangePartial(range, text, range_length=None)

LSP v3.18.0

Parameters:
range: Range

The range of the document that changed.

range_length: int | None

The optional length of the range that got replaced.

@deprecated use range instead.

text: str

The new text for the provided range.

class lsprotocol.types.TextDocumentContentChangeWholeDocument(text)

LSP v3.18.0

Parameters:

text (str)

text: str

The new text of the whole document.

class lsprotocol.types.TextDocumentContentClientCapabilities(dynamic_registration=None)

Client capabilities for a text document content provider.

LSP v3.18.0 @proposed

Parameters:

dynamic_registration (bool | None)

dynamic_registration: bool | None

Text document content provider supports dynamic registration.

class lsprotocol.types.TextDocumentContentOptions(schemes)

Text document content provider options.

LSP v3.18.0 @proposed

Parameters:

schemes (Sequence[str])

schemes: Sequence[str]

The schemes for which the server provides content.

class lsprotocol.types.TextDocumentContentParams(uri)

Parameters for the workspace/textDocumentContent request.

LSP v3.18.0 @proposed

Parameters:

uri (str)

uri: str

The uri of the text document.

class lsprotocol.types.TextDocumentContentRefreshParams(uri)

Parameters for the workspace/textDocumentContent/refresh request.

LSP v3.18.0 @proposed

Parameters:

uri (str)

uri: str

The uri of the text document to refresh.

class lsprotocol.types.TextDocumentContentRefreshRequest(id, params, method='workspace/textDocumentContent/refresh', jsonrpc='2.0')

The workspace/textDocumentContent request is sent from the server to the client to refresh the content of a specific text document.

LSP v3.18.0 @proposed

Parameters:
id: int | str

The request id.

jsonrpc: str
method: Literal['workspace/textDocumentContent/refresh']

The method to be invoked.

params: TextDocumentContentRefreshParams
class lsprotocol.types.TextDocumentContentRefreshResponse(id, result=None, jsonrpc='2.0')
Parameters:
  • id (int | str | None)

  • result (None)

  • jsonrpc (str)

id: int | str | None

The request id.

jsonrpc: str
result: None
class lsprotocol.types.TextDocumentContentRegistrationOptions(schemes, id=None)

Text document content provider registration options.

LSP v3.18.0 @proposed

Parameters:
id: str | None

The id used to register the request. The id can be used to deregister the request again. See also Registration#id.

schemes: Sequence[str]

The schemes for which the server provides content.

class lsprotocol.types.TextDocumentContentRequest(id, params, method='workspace/textDocumentContent', jsonrpc='2.0')

The workspace/textDocumentContent request is sent from the client to the server to request the content of a text document.

LSP v3.18.0 @proposed

Parameters:
id: int | str

The request id.

jsonrpc: str
method: Literal['workspace/textDocumentContent']

The method to be invoked.

params: TextDocumentContentParams
class lsprotocol.types.TextDocumentContentResponse(id, result=None, jsonrpc='2.0')
Parameters:
id: int | str | None

The request id.

jsonrpc: str
result: TextDocumentContentResult
class lsprotocol.types.TextDocumentContentResult(text)

Result of the workspace/textDocumentContent request.

LSP v3.18.0 @proposed

Parameters:

text (str)

text: str

The text content of the text document. Please note, that the content of any subsequent open notifications for the text document might differ from the returned content due to whitespace and line ending normalizations done on the client

class lsprotocol.types.TextDocumentEdit(text_document, edits)

Describes textual changes on a text document. A TextDocumentEdit describes all changes on a document version Si and after they are applied move the document to version Si+1. So the creator of a TextDocumentEdit doesn’t need to sort the array of edits or do any kind of ordering. However the edits must be non overlapping.

Parameters:
edits: Sequence[TextEdit | AnnotatedTextEdit | SnippetTextEdit]

The edits to be applied.

LSP v3.16.0 - support for AnnotatedTextEdit. This is guarded using a client capability.

LSP v3.18.0 - support for SnippetTextEdit. This is guarded using a client capability.

text_document: OptionalVersionedTextDocumentIdentifier

The text document to change.

class lsprotocol.types.TextDocumentFilterClientCapabilities(relative_pattern_support=None)
Parameters:

relative_pattern_support (bool | None)

relative_pattern_support: bool | None

The client supports Relative Patterns.

LSP v3.18.0

class lsprotocol.types.TextDocumentFilterLanguage(language, scheme=None, pattern=None)

A document filter where language is required field.

LSP v3.18.0

Parameters:
language: str

A language id, like typescript .

pattern: str | RelativePattern | None

A glob pattern, like **/*.{ts,js}. See TextDocumentFilter for examples.

LSP v3.18.0 - support for relative patterns. Whether clients support relative patterns depends on the client capability textDocuments.filters.relativePatternSupport .

scheme: str | None

A Uri {@link Uri.scheme scheme}, like file or untitled.

class lsprotocol.types.TextDocumentFilterPattern(pattern, language=None, scheme=None)

A document filter where pattern is required field.

LSP v3.18.0

Parameters:
language: str | None

A language id, like typescript .

pattern: str | RelativePattern

A glob pattern, like **/*.{ts,js}. See TextDocumentFilter for examples.

LSP v3.18.0 - support for relative patterns. Whether clients support relative patterns depends on the client capability textDocuments.filters.relativePatternSupport .

scheme: str | None

A Uri {@link Uri.scheme scheme}, like file or untitled.

class lsprotocol.types.TextDocumentFilterScheme(scheme, language=None, pattern=None)

A document filter where scheme is required field.

LSP v3.18.0

Parameters:
language: str | None

A language id, like typescript .

pattern: str | RelativePattern | None

A glob pattern, like **/*.{ts,js}. See TextDocumentFilter for examples.

LSP v3.18.0 - support for relative patterns. Whether clients support relative patterns depends on the client capability textDocuments.filters.relativePatternSupport .

scheme: str

A Uri {@link Uri.scheme scheme}, like file or untitled.

class lsprotocol.types.TextDocumentIdentifier(uri)

A literal to identify a text document in the client.

Parameters:

uri (str)

uri: str

The text document’s uri.

class lsprotocol.types.TextDocumentItem(uri, language_id, version, text)

An item to transfer a text document from the client to the server.

Parameters:
language_id: LanguageKind | str

The text document’s language identifier.

text: str

The content of the opened text document.

uri: str

The text document’s uri.

version: int

The version number of this document (it will increase after each change, including undo/redo).

class lsprotocol.types.TextDocumentPositionParams(text_document, position)

A parameter literal used in requests to pass a text document and a position inside that document.

Parameters:
position: Position

The position inside the text document.

text_document: TextDocumentIdentifier

The text document.

class lsprotocol.types.TextDocumentRegistrationOptions(document_selector=None)

General text document registration options.

Parameters:

document_selector (Sequence[TextDocumentFilterLanguage | TextDocumentFilterScheme | TextDocumentFilterPattern | NotebookCellTextDocumentFilter] | None)

document_selector: Sequence[TextDocumentFilterLanguage | TextDocumentFilterScheme | TextDocumentFilterPattern | NotebookCellTextDocumentFilter] | None

A document selector to identify the scope of the registration. If set to null the document selector provided on the client side will be used.

class lsprotocol.types.TextDocumentSaveReason(value)

Represents reasons why a text document is saved.

AfterDelay = 2

Automatic after a delay.

FocusOut = 3

When the editor lost focus.

Manual = 1

Manually triggered, e.g. by the user pressing save, by starting debugging, or by an API call.

class lsprotocol.types.TextDocumentSaveRegistrationOptions(document_selector=None, include_text=None)

Save registration options.

Parameters:
document_selector: Sequence[TextDocumentFilterLanguage | TextDocumentFilterScheme | TextDocumentFilterPattern | NotebookCellTextDocumentFilter] | None

A document selector to identify the scope of the registration. If set to null the document selector provided on the client side will be used.

include_text: bool | None

The client is supposed to include the content on save.

class lsprotocol.types.TextDocumentSyncClientCapabilities(dynamic_registration=None, will_save=None, will_save_wait_until=None, did_save=None)
Parameters:
  • dynamic_registration (bool | None)

  • will_save (bool | None)

  • will_save_wait_until (bool | None)

  • did_save (bool | None)

did_save: bool | None

The client supports did save notifications.

dynamic_registration: bool | None

Whether text document synchronization supports dynamic registration.

will_save: bool | None

The client supports sending will save notifications.

will_save_wait_until: bool | None

The client supports sending a will save request and waits for a response providing text edits which will be applied to the document before it is saved.

class lsprotocol.types.TextDocumentSyncKind(value)

Defines how the host (editor) should sync document changes to the language server.

Full = 1

Documents are synced by always sending the full content of the document.

Incremental = 2

Documents are synced by sending the full content on open. After that only incremental updates to the document are send.

None_ = 0

Documents should not be synced at all.

class lsprotocol.types.TextDocumentSyncOptions(open_close=None, change=None, will_save=None, will_save_wait_until=None, save=None)
Parameters:
change: TextDocumentSyncKind | None

Change notifications are sent to the server. See TextDocumentSyncKind.None, TextDocumentSyncKind.Full and TextDocumentSyncKind.Incremental. If omitted it defaults to TextDocumentSyncKind.None.

open_close: bool | None

Open and close notifications are sent to the server. If omitted open close notification should not be sent.

save: bool | SaveOptions | None

If present save notifications are sent to the server. If omitted the notification should not be sent.

will_save: bool | None

If present will save notifications are sent to the server. If omitted the notification should not be sent.

will_save_wait_until: bool | None

If present will save wait until requests are sent to the server. If omitted the request should not be sent.

class lsprotocol.types.TextEdit(range, new_text)

A text edit applicable to a text document.

Parameters:
new_text: str

The string to be inserted. For delete operations use an empty string.

range: Range

The range of the text document to be manipulated. To insert text into a document create a range where start === end.

class lsprotocol.types.TokenFormat(value)
Relative = 'relative'
class lsprotocol.types.TraceValue(value)
Messages = 'messages'

Trace messages only.

Off = 'off'

Turn tracing off.

Verbose = 'verbose'

Verbose message tracing.

class lsprotocol.types.TypeDefinitionClientCapabilities(dynamic_registration=None, link_support=None)

Since 3.6.0

Parameters:
  • dynamic_registration (bool | None)

  • link_support (bool | None)

dynamic_registration: bool | None

Whether implementation supports dynamic registration. If this is set to true the client supports the new TypeDefinitionRegistrationOptions return value for the corresponding server capability as well.

The client supports additional metadata in the form of definition links.

Since 3.14.0

class lsprotocol.types.TypeDefinitionOptions(work_done_progress=None)
Parameters:

work_done_progress (bool | None)

work_done_progress: bool | None
class lsprotocol.types.TypeDefinitionParams(text_document, position, work_done_token=None, partial_result_token=None)
Parameters:
partial_result_token: int | str | None

An optional token that a server can use to report partial results (e.g. streaming) to the client.

position: Position

The position inside the text document.

text_document: TextDocumentIdentifier

The text document.

work_done_token: int | str | None

An optional token that a server can use to report work done progress.

class lsprotocol.types.TypeDefinitionRegistrationOptions(document_selector=None, work_done_progress=None, id=None)
Parameters:
document_selector: Sequence[TextDocumentFilterLanguage | TextDocumentFilterScheme | TextDocumentFilterPattern | NotebookCellTextDocumentFilter] | None

A document selector to identify the scope of the registration. If set to null the document selector provided on the client side will be used.

id: str | None

The id used to register the request. The id can be used to deregister the request again. See also Registration#id.

work_done_progress: bool | None
class lsprotocol.types.TypeDefinitionRequest(id, params, method='textDocument/typeDefinition', jsonrpc='2.0')

A request to resolve the type definition locations of a symbol at a given text document position. The request’s parameter is of type TextDocumentPositionParams the response is of type Definition or a Thenable that resolves to such.

Parameters:
id: int | str

The request id.

jsonrpc: str
method: Literal['textDocument/typeDefinition']

The method to be invoked.

params: TypeDefinitionParams
class lsprotocol.types.TypeDefinitionResponse(id, result=None, jsonrpc='2.0')
Parameters:
id: int | str | None

The request id.

jsonrpc: str
result: Location | Sequence[Location] | Sequence[LocationLink] | None
class lsprotocol.types.TypeHierarchyClientCapabilities(dynamic_registration=None)

LSP v3.17.0

Parameters:

dynamic_registration (bool | None)

dynamic_registration: bool | None

Whether implementation supports dynamic registration. If this is set to true the client supports the new (TextDocumentRegistrationOptions & StaticRegistrationOptions) return value for the corresponding server capability as well.

class lsprotocol.types.TypeHierarchyItem(name, kind, uri, range, selection_range, tags=None, detail=None, data=None)

LSP v3.17.0

Parameters:
data: Any | None

A data entry field that is preserved between a type hierarchy prepare and supertypes or subtypes requests. It could also be used to identify the type hierarchy in the server, helping improve the performance on resolving supertypes and subtypes.

detail: str | None

More detail for this item, e.g. the signature of a function.

kind: SymbolKind

The kind of this item.

name: str

The name of this item.

range: Range

The range enclosing this symbol not including leading/trailing whitespace but everything else, e.g. comments and code.

selection_range: Range

The range that should be selected and revealed when this symbol is being picked, e.g. the name of a function. Must be contained by the {@link TypeHierarchyItem.range range }.

tags: Sequence[SymbolTag] | None

Tags for this item.

uri: str

The resource identifier of this item.

class lsprotocol.types.TypeHierarchyOptions(work_done_progress=None)

Type hierarchy options used during static registration.

LSP v3.17.0

Parameters:

work_done_progress (bool | None)

work_done_progress: bool | None
class lsprotocol.types.TypeHierarchyPrepareParams(text_document, position, work_done_token=None)

The parameter of a textDocument/prepareTypeHierarchy request.

LSP v3.17.0

Parameters:
position: Position

The position inside the text document.

text_document: TextDocumentIdentifier

The text document.

work_done_token: int | str | None

An optional token that a server can use to report work done progress.

class lsprotocol.types.TypeHierarchyPrepareRequest(id, params, method='textDocument/prepareTypeHierarchy', jsonrpc='2.0')

A request to result a TypeHierarchyItem in a document at a given position. Can be used as an input to a subtypes or supertypes type hierarchy.

LSP v3.17.0

Parameters:
id: int | str

The request id.

jsonrpc: str
method: Literal['textDocument/prepareTypeHierarchy']

The method to be invoked.

params: TypeHierarchyPrepareParams
class lsprotocol.types.TypeHierarchyPrepareResponse(id, result=None, jsonrpc='2.0')
Parameters:
id: int | str | None

The request id.

jsonrpc: str
result: Sequence[TypeHierarchyItem] | None
class lsprotocol.types.TypeHierarchyRegistrationOptions(document_selector=None, work_done_progress=None, id=None)

Type hierarchy options used during static or dynamic registration.

LSP v3.17.0

Parameters:
document_selector: Sequence[TextDocumentFilterLanguage | TextDocumentFilterScheme | TextDocumentFilterPattern | NotebookCellTextDocumentFilter] | None

A document selector to identify the scope of the registration. If set to null the document selector provided on the client side will be used.

id: str | None

The id used to register the request. The id can be used to deregister the request again. See also Registration#id.

work_done_progress: bool | None
class lsprotocol.types.TypeHierarchySubtypesParams(item, work_done_token=None, partial_result_token=None)

The parameter of a typeHierarchy/subtypes request.

LSP v3.17.0

Parameters:
item: TypeHierarchyItem
partial_result_token: int | str | None

An optional token that a server can use to report partial results (e.g. streaming) to the client.

work_done_token: int | str | None

An optional token that a server can use to report work done progress.

class lsprotocol.types.TypeHierarchySubtypesRequest(id, params, method='typeHierarchy/subtypes', jsonrpc='2.0')

A request to resolve the subtypes for a given TypeHierarchyItem .

LSP v3.17.0

Parameters:
id: int | str

The request id.

jsonrpc: str
method: Literal['typeHierarchy/subtypes']

The method to be invoked.

params: TypeHierarchySubtypesParams
class lsprotocol.types.TypeHierarchySubtypesResponse(id, result=None, jsonrpc='2.0')
Parameters:
id: int | str | None

The request id.

jsonrpc: str
result: Sequence[TypeHierarchyItem] | None
class lsprotocol.types.TypeHierarchySupertypesParams(item, work_done_token=None, partial_result_token=None)

The parameter of a typeHierarchy/supertypes request.

LSP v3.17.0

Parameters:
item: TypeHierarchyItem
partial_result_token: int | str | None

An optional token that a server can use to report partial results (e.g. streaming) to the client.

work_done_token: int | str | None

An optional token that a server can use to report work done progress.

class lsprotocol.types.TypeHierarchySupertypesRequest(id, params, method='typeHierarchy/supertypes', jsonrpc='2.0')

A request to resolve the supertypes for a given TypeHierarchyItem .

LSP v3.17.0

Parameters:
id: int | str

The request id.

jsonrpc: str
method: Literal['typeHierarchy/supertypes']

The method to be invoked.

params: TypeHierarchySupertypesParams
class lsprotocol.types.TypeHierarchySupertypesResponse(id, result=None, jsonrpc='2.0')
Parameters:
id: int | str | None

The request id.

jsonrpc: str
result: Sequence[TypeHierarchyItem] | None
class lsprotocol.types.UnchangedDocumentDiagnosticReport(result_id, kind='unchanged')

A diagnostic report indicating that the last returned report is still accurate.

LSP v3.17.0

Parameters:
kind: str

A document diagnostic report indicating no changes to the last result. A server can only return unchanged if result ids are provided.

result_id: str

A result id which will be sent on the next diagnostic request for the same document.

class lsprotocol.types.UniquenessLevel(value)

Moniker uniqueness level to define scope of the moniker.

LSP v3.16.0

Document = 'document'

The moniker is only unique inside a document

Global = 'global'

The moniker is globally unique

Group = 'group'

The moniker is unique inside the group to which a project belongs

Project = 'project'

The moniker is unique inside a project for which a dump got created

Scheme = 'scheme'

The moniker is unique inside the moniker scheme.

class lsprotocol.types.Unregistration(id, method)

General parameters to unregister a request or notification.

Parameters:
id: str

The id used to unregister the request or notification. Usually an id provided during the register request.

method: str

The method to unregister for.

class lsprotocol.types.UnregistrationParams(unregisterations)
Parameters:

unregisterations (Sequence[Unregistration])

unregisterations: Sequence[Unregistration]
class lsprotocol.types.UnregistrationRequest(id, params, method='client/unregisterCapability', jsonrpc='2.0')

The client/unregisterCapability request is sent from the server to the client to unregister a previously registered capability handler on the client side.

Parameters:
id: int | str

The request id.

jsonrpc: str
method: Literal['client/unregisterCapability']

The method to be invoked.

params: UnregistrationParams
class lsprotocol.types.UnregistrationResponse(id, result=None, jsonrpc='2.0')
Parameters:
  • id (int | str | None)

  • result (None)

  • jsonrpc (str)

id: int | str | None

The request id.

jsonrpc: str
result: None
class lsprotocol.types.VersionedNotebookDocumentIdentifier(version, uri)

A versioned notebook document identifier.

LSP v3.17.0

Parameters:
uri: str

The notebook document’s uri.

version: int

The version number of this notebook document.

class lsprotocol.types.VersionedTextDocumentIdentifier(version, uri)

A text document identifier to denote a specific version of a text document.

Parameters:
uri: str

The text document’s uri.

version: int

The version number of this document.

class lsprotocol.types.WatchKind(value)
Change = 2

Interested in change events

Create = 1

Interested in create events.

Delete = 4

Interested in delete events

class lsprotocol.types.WillCreateFilesRequest(id, params, method='workspace/willCreateFiles', jsonrpc='2.0')

The will create files request is sent from the client to the server before files are actually created as long as the creation is triggered from within the client.

The request can return a WorkspaceEdit which will be applied to workspace before the files are created. Hence the WorkspaceEdit can not manipulate the content of the file to be created.

LSP v3.16.0

Parameters:
id: int | str

The request id.

jsonrpc: str
method: Literal['workspace/willCreateFiles']

The method to be invoked.

params: CreateFilesParams
class lsprotocol.types.WillCreateFilesResponse(id, result=None, jsonrpc='2.0')
Parameters:
id: int | str | None

The request id.

jsonrpc: str
result: WorkspaceEdit | None
class lsprotocol.types.WillDeleteFilesRequest(id, params, method='workspace/willDeleteFiles', jsonrpc='2.0')

The did delete files notification is sent from the client to the server when files were deleted from within the client.

LSP v3.16.0

Parameters:
id: int | str

The request id.

jsonrpc: str
method: Literal['workspace/willDeleteFiles']

The method to be invoked.

params: DeleteFilesParams
class lsprotocol.types.WillDeleteFilesResponse(id, result=None, jsonrpc='2.0')
Parameters:
id: int | str | None

The request id.

jsonrpc: str
result: WorkspaceEdit | None
class lsprotocol.types.WillRenameFilesRequest(id, params, method='workspace/willRenameFiles', jsonrpc='2.0')

The will rename files request is sent from the client to the server before files are actually renamed as long as the rename is triggered from within the client.

LSP v3.16.0

Parameters:
id: int | str

The request id.

jsonrpc: str
method: Literal['workspace/willRenameFiles']

The method to be invoked.

params: RenameFilesParams
class lsprotocol.types.WillRenameFilesResponse(id, result=None, jsonrpc='2.0')
Parameters:
id: int | str | None

The request id.

jsonrpc: str
result: WorkspaceEdit | None
class lsprotocol.types.WillSaveTextDocumentNotification(params, method='textDocument/willSave', jsonrpc='2.0')

A document will save notification is sent from the client to the server before the document is actually saved.

Parameters:
jsonrpc: str
method: Literal['textDocument/willSave']

The method to be invoked.

params: WillSaveTextDocumentParams
class lsprotocol.types.WillSaveTextDocumentParams(text_document, reason)

The parameters sent in a will save text document notification.

Parameters:
reason: TextDocumentSaveReason

The ‘TextDocumentSaveReason’.

text_document: TextDocumentIdentifier

The document that will be saved.

class lsprotocol.types.WillSaveTextDocumentWaitUntilRequest(id, params, method='textDocument/willSaveWaitUntil', jsonrpc='2.0')

A document will save request is sent from the client to the server before the document is actually saved. The request can return an array of TextEdits which will be applied to the text document before it is saved. Please note that clients might drop results if computing the text edits took too long or if a server constantly fails on this request. This is done to keep the save fast and reliable.

Parameters:
id: int | str

The request id.

jsonrpc: str
method: Literal['textDocument/willSaveWaitUntil']

The method to be invoked.

params: WillSaveTextDocumentParams
class lsprotocol.types.WillSaveTextDocumentWaitUntilResponse(id, result=None, jsonrpc='2.0')
Parameters:
id: int | str | None

The request id.

jsonrpc: str
result: Sequence[TextEdit] | None
class lsprotocol.types.WindowClientCapabilities(work_done_progress=None, show_message=None, show_document=None)
Parameters:
show_document: ShowDocumentClientCapabilities | None

Capabilities specific to the showDocument request.

LSP v3.16.0

show_message: ShowMessageRequestClientCapabilities | None

Capabilities specific to the showMessage request.

LSP v3.16.0

work_done_progress: bool | None

It indicates whether the client supports server initiated progress using the window/workDoneProgress/create request.

The capability also controls Whether client supports handling of progress notifications. If set servers are allowed to report a workDoneProgress property in the request specific server capabilities.

LSP v3.15.0

class lsprotocol.types.WorkDoneProgressBegin(title, kind='begin', cancellable=None, message=None, percentage=None)
Parameters:
  • title (str)

  • kind (str)

  • cancellable (bool | None)

  • message (str | None)

  • percentage (int | None)

cancellable: bool | None

Controls if a cancel button should show to allow the user to cancel the long running operation. Clients that don’t support cancellation are allowed to ignore the setting.

kind: str
message: str | None

Optional, more detailed associated progress message. Contains complementary information to the title .

Examples: “3/25 files”, “project/src/module2”, “node_modules/some_dep”. If unset, the previous progress message (if any) is still valid.

percentage: int | None

Optional progress percentage to display (value 100 is considered 100%). If not provided infinite progress is assumed and clients are allowed to ignore the percentage value in subsequent in report notifications.

The value should be steadily rising. Clients are free to ignore values that are not following this rule. The value range is [0, 100].

title: str

Mandatory title of the progress operation. Used to briefly inform about the kind of operation being performed.

Examples: “Indexing” or “Linking dependencies”.

class lsprotocol.types.WorkDoneProgressCancelNotification(params, method='window/workDoneProgress/cancel', jsonrpc='2.0')

The window/workDoneProgress/cancel notification is sent from the client to the server to cancel a progress initiated on the server side.

Parameters:
jsonrpc: str
method: Literal['window/workDoneProgress/cancel']

The method to be invoked.

params: WorkDoneProgressCancelParams
class lsprotocol.types.WorkDoneProgressCancelParams(token)
Parameters:

token (int | str)

token: int | str

The token to be used to report progress.

class lsprotocol.types.WorkDoneProgressCreateParams(token)
Parameters:

token (int | str)

token: int | str

The token to be used to report progress.

class lsprotocol.types.WorkDoneProgressCreateRequest(id, params, method='window/workDoneProgress/create', jsonrpc='2.0')

The window/workDoneProgress/create request is sent from the server to the client to initiate progress reporting from the server.

Parameters:
id: int | str

The request id.

jsonrpc: str
method: Literal['window/workDoneProgress/create']

The method to be invoked.

params: WorkDoneProgressCreateParams
class lsprotocol.types.WorkDoneProgressCreateResponse(id, result=None, jsonrpc='2.0')
Parameters:
  • id (int | str | None)

  • result (None)

  • jsonrpc (str)

id: int | str | None

The request id.

jsonrpc: str
result: None
class lsprotocol.types.WorkDoneProgressEnd(kind='end', message=None)
Parameters:
  • kind (str)

  • message (str | None)

kind: str
message: str | None

Optional, a final message indicating to for example indicate the outcome of the operation.

class lsprotocol.types.WorkDoneProgressOptions(work_done_progress=None)
Parameters:

work_done_progress (bool | None)

work_done_progress: bool | None
class lsprotocol.types.WorkDoneProgressParams(work_done_token=None)
Parameters:

work_done_token (int | str | None)

work_done_token: int | str | None

An optional token that a server can use to report work done progress.

class lsprotocol.types.WorkDoneProgressReport(kind='report', cancellable=None, message=None, percentage=None)
Parameters:
  • kind (str)

  • cancellable (bool | None)

  • message (str | None)

  • percentage (int | None)

cancellable: bool | None

Controls enablement state of a cancel button.

Clients that don’t support cancellation or don’t support controlling the button’s enablement state are allowed to ignore the property.

kind: str
message: str | None

Optional, more detailed associated progress message. Contains complementary information to the title .

Examples: “3/25 files”, “project/src/module2”, “node_modules/some_dep”. If unset, the previous progress message (if any) is still valid.

percentage: int | None

Optional progress percentage to display (value 100 is considered 100%). If not provided infinite progress is assumed and clients are allowed to ignore the percentage value in subsequent in report notifications.

The value should be steadily rising. Clients are free to ignore values that are not following this rule. The value range is [0, 100]

class lsprotocol.types.WorkspaceClientCapabilities(apply_edit=None, workspace_edit=None, did_change_configuration=None, did_change_watched_files=None, symbol=None, execute_command=None, workspace_folders=None, configuration=None, semantic_tokens=None, code_lens=None, file_operations=None, inline_value=None, inlay_hint=None, diagnostics=None, folding_range=None, text_document_content=None)

Workspace specific client capabilities.

Parameters:
apply_edit: bool | None

The client supports applying batch edits to the workspace by supporting the request ‘workspace/applyEdit’

code_lens: CodeLensWorkspaceClientCapabilities | None

Capabilities specific to the code lens requests scoped to the workspace.

LSP v3.16.0.

configuration: bool | None

The client supports workspace/configuration requests.

LSP v3.6.0

diagnostics: DiagnosticWorkspaceClientCapabilities | None

Capabilities specific to the diagnostic requests scoped to the workspace.

LSP v3.17.0.

did_change_configuration: DidChangeConfigurationClientCapabilities | None

Capabilities specific to the workspace/didChangeConfiguration notification.

did_change_watched_files: DidChangeWatchedFilesClientCapabilities | None

Capabilities specific to the workspace/didChangeWatchedFiles notification.

execute_command: ExecuteCommandClientCapabilities | None

Capabilities specific to the workspace/executeCommand request.

file_operations: FileOperationClientCapabilities | None

The client has support for file notifications/requests for user operations on files.

Since 3.16.0

folding_range: FoldingRangeWorkspaceClientCapabilities | None

Capabilities specific to the folding range requests scoped to the workspace.

LSP v3.18.0 @proposed

inlay_hint: InlayHintWorkspaceClientCapabilities | None

Capabilities specific to the inlay hint requests scoped to the workspace.

LSP v3.17.0.

inline_value: InlineValueWorkspaceClientCapabilities | None

Capabilities specific to the inline values requests scoped to the workspace.

LSP v3.17.0.

semantic_tokens: SemanticTokensWorkspaceClientCapabilities | None

Capabilities specific to the semantic token requests scoped to the workspace.

LSP v3.16.0.

symbol: WorkspaceSymbolClientCapabilities | None

Capabilities specific to the workspace/symbol request.

text_document_content: TextDocumentContentClientCapabilities | None

Capabilities specific to the workspace/textDocumentContent request.

LSP v3.18.0 @proposed

workspace_edit: WorkspaceEditClientCapabilities | None

Capabilities specific to WorkspaceEdit s.

workspace_folders: bool | None

The client has support for workspace folders.

LSP v3.6.0

class lsprotocol.types.WorkspaceDiagnosticParams(previous_result_ids, identifier=None, work_done_token=None, partial_result_token=None)

Parameters of the workspace diagnostic request.

LSP v3.17.0

Parameters:
identifier: str | None

The additional identifier provided during registration.

partial_result_token: int | str | None

An optional token that a server can use to report partial results (e.g. streaming) to the client.

previous_result_ids: Sequence[PreviousResultId]

The currently known diagnostic reports with their previous result ids.

work_done_token: int | str | None

An optional token that a server can use to report work done progress.

class lsprotocol.types.WorkspaceDiagnosticReport(items)

A workspace diagnostic report.

LSP v3.17.0

Parameters:

items (Sequence[WorkspaceFullDocumentDiagnosticReport | WorkspaceUnchangedDocumentDiagnosticReport])

items: Sequence[WorkspaceFullDocumentDiagnosticReport | WorkspaceUnchangedDocumentDiagnosticReport]
class lsprotocol.types.WorkspaceDiagnosticReportPartialResult(items)

A partial result for a workspace diagnostic report.

LSP v3.17.0

Parameters:

items (Sequence[WorkspaceFullDocumentDiagnosticReport | WorkspaceUnchangedDocumentDiagnosticReport])

items: Sequence[WorkspaceFullDocumentDiagnosticReport | WorkspaceUnchangedDocumentDiagnosticReport]
class lsprotocol.types.WorkspaceDiagnosticRequest(id, params, method='workspace/diagnostic', jsonrpc='2.0')

The workspace diagnostic request definition.

LSP v3.17.0

Parameters:
id: int | str

The request id.

jsonrpc: str
method: Literal['workspace/diagnostic']

The method to be invoked.

params: WorkspaceDiagnosticParams
class lsprotocol.types.WorkspaceDiagnosticResponse(id, result=None, jsonrpc='2.0')
Parameters:
id: int | str | None

The request id.

jsonrpc: str
result: WorkspaceDiagnosticReport
class lsprotocol.types.WorkspaceEdit(changes=None, document_changes=None, change_annotations=None)

A workspace edit represents changes to many resources managed in the workspace. The edit should either provide changes or documentChanges. If documentChanges are present they are preferred over changes if the client can handle versioned document edits.

Since version 3.13.0 a workspace edit can contain resource operations as well. If resource operations are present clients need to execute the operations in the order in which they are provided. So a workspace edit for example can consist of the following two changes: (1) a create file a.txt and (2) a text document edit which insert text into file a.txt.

An invalid sequence (e.g. (1) delete file a.txt and (2) insert text into file a.txt) will cause failure of the operation. How the client recovers from the failure is described by the client capability: workspace.workspaceEdit.failureHandling

Parameters:
change_annotations: Mapping[str, ChangeAnnotation] | None

A map of change annotations that can be referenced in AnnotatedTextEdit s or create, rename and delete file / folder operations.

Whether clients honor this property depends on the client capability workspace.changeAnnotationSupport .

LSP v3.16.0

changes: Mapping[str, Sequence[TextEdit]] | None

Holds changes to existing resources.

document_changes: Sequence[TextDocumentEdit | CreateFile | RenameFile | DeleteFile] | None

Depending on the client capability workspace.workspaceEdit.resourceOperations document changes are either an array of TextDocumentEdit s to express changes to n different text documents where each text document edit addresses a specific version of a text document. Or it can contain above TextDocumentEdit s mixed with create, rename and delete file / folder operations.

Whether a client supports versioned document edits is expressed via workspace.workspaceEdit.documentChanges client capability.

If a client neither supports documentChanges nor workspace.workspaceEdit.resourceOperations then only plain TextEdit s using the changes property are supported.

class lsprotocol.types.WorkspaceEditClientCapabilities(document_changes=None, resource_operations=None, failure_handling=None, normalizes_line_endings=None, change_annotation_support=None, metadata_support=None, snippet_edit_support=None)
Parameters:
change_annotation_support: ChangeAnnotationsSupportOptions | None

Whether the client in general supports change annotations on text edits, create file, rename file and delete file changes.

LSP v3.16.0

document_changes: bool | None

The client supports versioned document changes in WorkspaceEdit s

failure_handling: FailureHandlingKind | None

The failure handling strategy of a client if applying the workspace edit fails.

LSP v3.13.0

metadata_support: bool | None

Whether the client supports WorkspaceEditMetadata in `WorkspaceEdit`s.

LSP v3.18.0 @proposed

normalizes_line_endings: bool | None

Whether the client normalizes line endings to the client specific setting. If set to true the client will normalize line ending characters in a workspace edit to the client-specified new line character.

LSP v3.16.0

resource_operations: Sequence[ResourceOperationKind] | None

The resource operations the client supports. Clients should at least support ‘create’, ‘rename’ and ‘delete’ files and folders.

LSP v3.13.0

snippet_edit_support: bool | None

Whether the client supports snippets as text edits.

LSP v3.18.0 @proposed

class lsprotocol.types.WorkspaceEditMetadata(is_refactoring=None)

Additional data about a workspace edit.

LSP v3.18.0 @proposed

Parameters:

is_refactoring (bool | None)

is_refactoring: bool | None

Signal to the editor that this edit is a refactoring.

class lsprotocol.types.WorkspaceFolder(uri, name)

A workspace folder inside a client.

Parameters:
name: str

The name of the workspace folder. Used to refer to this workspace folder in the user interface.

uri: str

The associated URI for this workspace folder.

class lsprotocol.types.WorkspaceFoldersChangeEvent(added, removed)

The workspace folder change event.

Parameters:
added: Sequence[WorkspaceFolder]

The array of added workspace folders

removed: Sequence[WorkspaceFolder]

The array of the removed workspace folders

class lsprotocol.types.WorkspaceFoldersInitializeParams(workspace_folders=None)
Parameters:

workspace_folders (Sequence[WorkspaceFolder] | None)

workspace_folders: Sequence[WorkspaceFolder] | None

The workspace folders configured in the client when the server starts.

This property is only available if the client supports workspace folders. It can be null if the client supports workspace folders but none are configured.

LSP v3.6.0

class lsprotocol.types.WorkspaceFoldersRequest(id, params=None, method='workspace/workspaceFolders', jsonrpc='2.0')

The workspace/workspaceFolders is sent from the server to the client to fetch the open workspace folders.

Parameters:
  • id (int | str)

  • params (None)

  • method (Literal['workspace/workspaceFolders'])

  • jsonrpc (str)

id: int | str

The request id.

jsonrpc: str
method: Literal['workspace/workspaceFolders']

The method to be invoked.

params: None
class lsprotocol.types.WorkspaceFoldersResponse(id, result=None, jsonrpc='2.0')
Parameters:
id: int | str | None

The request id.

jsonrpc: str
result: Sequence[WorkspaceFolder] | None
class lsprotocol.types.WorkspaceFoldersServerCapabilities(supported=None, change_notifications=None)
Parameters:
  • supported (bool | None)

  • change_notifications (str | bool | None)

change_notifications: str | bool | None

Whether the server wants to receive workspace folder change notifications.

If a string is provided the string is treated as an ID under which the notification is registered on the client side. The ID can be used to unregister for these events using the client/unregisterCapability request.

supported: bool | None

The server has support for workspace folders

class lsprotocol.types.WorkspaceFullDocumentDiagnosticReport(uri, items, version=None, kind='full', result_id=None)

A full document diagnostic report for a workspace diagnostic result.

LSP v3.17.0

Parameters:
items: Sequence[Diagnostic]

The actual items.

kind: str

A full document diagnostic report.

result_id: str | None

An optional result id. If provided it will be sent on the next diagnostic request for the same document.

uri: str

The URI for which diagnostic information is reported.

version: int | None

The version number for which the diagnostics are reported. If the document is not marked as open null can be provided.

class lsprotocol.types.WorkspaceOptions(workspace_folders=None, file_operations=None, text_document_content=None)

Defines workspace specific capabilities of the server.

LSP v3.18.0

Parameters:
file_operations: FileOperationOptions | None

The server is interested in notifications/requests for operations on files.

LSP v3.16.0

text_document_content: TextDocumentContentOptions | TextDocumentContentRegistrationOptions | None

The server supports the workspace/textDocumentContent request.

LSP v3.18.0 @proposed

workspace_folders: WorkspaceFoldersServerCapabilities | None

The server supports workspace folder.

LSP v3.6.0

class lsprotocol.types.WorkspaceSymbol(location, name, kind, data=None, tags=None, container_name=None)

A special workspace symbol that supports locations without a range.

See also SymbolInformation.

LSP v3.17.0

Parameters:
container_name: str | None

The name of the symbol containing this symbol. This information is for user interface purposes (e.g. to render a qualifier in the user interface if necessary). It can’t be used to re-infer a hierarchy for the document symbols.

data: Any | None

A data entry field that is preserved on a workspace symbol between a workspace symbol request and a workspace symbol resolve request.

kind: SymbolKind

The kind of this symbol.

location: Location | LocationUriOnly

The location of the symbol. Whether a server is allowed to return a location without a range depends on the client capability workspace.symbol.resolveSupport .

See SymbolInformation#location for more details.

name: str

The name of this symbol.

tags: Sequence[SymbolTag] | None

Tags for this symbol.

LSP v3.16.0

class lsprotocol.types.WorkspaceSymbolClientCapabilities(dynamic_registration=None, symbol_kind=None, tag_support=None, resolve_support=None)

Client capabilities for a WorkspaceSymbolRequest.

Parameters:
dynamic_registration: bool | None

Symbol request supports dynamic registration.

resolve_support: ClientSymbolResolveOptions | None

The client support partial workspace symbols. The client will send the request workspaceSymbol/resolve to the server to resolve additional properties.

LSP v3.17.0

symbol_kind: ClientSymbolKindOptions | None

Specific capabilities for the SymbolKind in the workspace/symbol request.

tag_support: ClientSymbolTagOptions | None

The client supports tags on SymbolInformation . Clients supporting tags have to handle unknown tags gracefully.

LSP v3.16.0

class lsprotocol.types.WorkspaceSymbolOptions(resolve_provider=None, work_done_progress=None)

Server capabilities for a WorkspaceSymbolRequest.

Parameters:
  • resolve_provider (bool | None)

  • work_done_progress (bool | None)

resolve_provider: bool | None

The server provides support to resolve additional information for a workspace symbol.

LSP v3.17.0

work_done_progress: bool | None
class lsprotocol.types.WorkspaceSymbolParams(query, work_done_token=None, partial_result_token=None)

The parameters of a WorkspaceSymbolRequest.

Parameters:
  • query (str)

  • work_done_token (int | str | None)

  • partial_result_token (int | str | None)

partial_result_token: int | str | None

An optional token that a server can use to report partial results (e.g. streaming) to the client.

query: str

A query string to filter symbols by. Clients may send an empty string here to request all symbols.

The query -parameter should be interpreted in a relaxed way as editors will apply their own highlighting and scoring on the results. A good rule of thumb is to match case-insensitive and to simply check that the characters of query appear in their order in a candidate symbol. Servers shouldn’t use prefix, substring, or similar strict matching.

work_done_token: int | str | None

An optional token that a server can use to report work done progress.

class lsprotocol.types.WorkspaceSymbolRegistrationOptions(resolve_provider=None, work_done_progress=None)

Registration options for a WorkspaceSymbolRequest.

Parameters:
  • resolve_provider (bool | None)

  • work_done_progress (bool | None)

resolve_provider: bool | None

The server provides support to resolve additional information for a workspace symbol.

LSP v3.17.0

work_done_progress: bool | None
class lsprotocol.types.WorkspaceSymbolRequest(id, params, method='workspace/symbol', jsonrpc='2.0')

A request to list project-wide symbols matching the query string given by the WorkspaceSymbolParams. The response is of type SymbolInformation SymbolInformation[] or a Thenable that resolves to such.

LSP v3.17.0 - support for WorkspaceSymbol in the returned data. Clients

need to advertise support for WorkspaceSymbols via the client capability workspace.symbol.resolveSupport .

Parameters:
id: int | str

The request id.

jsonrpc: str
method: Literal['workspace/symbol']

The method to be invoked.

params: WorkspaceSymbolParams
class lsprotocol.types.WorkspaceSymbolResolveRequest(id, params, method='workspaceSymbol/resolve', jsonrpc='2.0')

A request to resolve the range inside the workspace symbol’s location.

LSP v3.17.0

Parameters:
id: int | str

The request id.

jsonrpc: str
method: Literal['workspaceSymbol/resolve']

The method to be invoked.

params: WorkspaceSymbol
class lsprotocol.types.WorkspaceSymbolResolveResponse(id, result=None, jsonrpc='2.0')
Parameters:
id: int | str | None

The request id.

jsonrpc: str
result: WorkspaceSymbol
class lsprotocol.types.WorkspaceSymbolResponse(id, result=None, jsonrpc='2.0')
Parameters:
id: int | str | None

The request id.

jsonrpc: str
result: Sequence[SymbolInformation] | Sequence[WorkspaceSymbol] | None
class lsprotocol.types.WorkspaceUnchangedDocumentDiagnosticReport(uri, result_id, version=None, kind='unchanged')

An unchanged document diagnostic report for a workspace diagnostic result.

LSP v3.17.0

Parameters:
kind: str

A document diagnostic report indicating no changes to the last result. A server can only return unchanged if result ids are provided.

result_id: str

A result id which will be sent on the next diagnostic request for the same document.

uri: str

The URI for which diagnostic information is reported.

version: int | None

The version number for which the diagnostics are reported. If the document is not marked as open null can be provided.

lsprotocol.types.is_keyword_class(cls)

Returns true if the class has a property that may be python keyword.

Parameters:

cls (type)

Return type:

bool

lsprotocol.types.is_special_class(cls)

Returns true if the class or its properties require special handling.

Parameters:

cls (type)

Return type:

bool

lsprotocol.types.is_special_property(cls, property_name)

Returns true if the class or its properties require special handling. .. rubric:: Example

Consider RenameRegistrationOptions
  • document_selector property:

    When you set document_selector to None in python it has to be preserved when serializing it. Since the serialized JSON value {"document_selector": null} means use the Clients document selector. Omitting it might throw error.

  • prepare_provider property

    This property does NOT need special handling, since omitting it or using {"prepare_provider": null} in JSON has the same meaning.

Parameters:
Return type:

bool

lsprotocol.types.message_direction(method)

Returns message direction clientToServer, serverToClient or both.

Parameters:

method (str)

Return type:

str

lsprotocol.types.Declaration

The declaration of a symbol representation as one or many Location locations.

alias of Location | Sequence[Location]

Information about where a symbol is declared.

Provides additional metadata over normal Location location declarations, including the range of the declaring symbol.

Servers should prefer returning DeclarationLink over Declaration if supported by the client.

lsprotocol.types.Definition

The definition of a symbol represented as one or many Location locations. For most programming languages there is only one location at which a symbol is defined.

Servers should prefer returning DefinitionLink over Definition if supported by the client.

alias of Location | Sequence[Location]

Information about where a symbol is defined.

Provides additional metadata over normal Location location definitions, including the range of the defining symbol

lsprotocol.types.DocumentDiagnosticReport

The result of a document diagnostic pull request. A report can either be a full report containing all diagnostics for the requested document or an unchanged report indicating that nothing has changed in terms of diagnostics in comparison to the last pull request.

LSP v3.17.0

alias of RelatedFullDocumentDiagnosticReport | RelatedUnchangedDocumentDiagnosticReport

lsprotocol.types.DocumentFilter

A document filter describes a top level text document or a notebook cell document.

LSP v3.17.0 - support for NotebookCellTextDocumentFilter.

alias of TextDocumentFilter | NotebookCellTextDocumentFilter

lsprotocol.types.DocumentSelector

A document selector is the combination of one or many document filters.

@sample let sel:DocumentSelector = [{ language: 'typescript' }, { language: 'json', pattern: '**/tsconfig.json' }] ;

The use of a string as a document filter is deprecated LSP v3.16.0.

alias of Sequence[DocumentFilter]

lsprotocol.types.GlobPattern

The glob pattern. Either a string pattern or a relative pattern.

LSP v3.17.0

alias of Pattern | RelativePattern

lsprotocol.types.InlineValue

Inline value information can be provided by different means:

  • directly as a text value (class InlineValueText).

  • as a name to use for a variable lookup (class InlineValueVariableLookup)

  • as an evaluatable expression (class InlineValueEvaluatableExpression)

The InlineValue types combines all inline value types into one type.

LSP v3.17.0

alias of InlineValueText | InlineValueVariableLookup | InlineValueEvaluatableExpression

lsprotocol.types.LSPAny

The LSP any type. Please note that strictly speaking a property with the value undefined can’t be converted into JSON preserving the property name. However for convenience it is allowed and assumed that all these properties are optional as well. LSP v3.17.0

alias of Any | None

lsprotocol.types.LSPArray

LSP arrays. LSP v3.17.0

alias of Sequence[LSPAny]

lsprotocol.types.MarkedString

MarkedString can be used to render human readable text. It is either a markdown string or a code-block that provides a language and a code snippet. The language identifier is semantically equal to the optional language identifier in fenced code blocks in GitHub issues. See https://help.github.com/articles/creating-and-highlighting-code-blocks/#syntax-highlighting

The pair of a language and a value is an equivalent to markdown:

${value}

Note that markdown strings will be sanitized - that means html will be escaped. @deprecated use MarkupContent instead.

alias of str | MarkedStringWithLanguage

lsprotocol.types.NotebookDocumentFilter

A notebook document filter denotes a notebook document by different properties. The properties will be match against the notebook’s URI (same as with documents)

LSP v3.17.0

alias of NotebookDocumentFilterNotebookType | NotebookDocumentFilterScheme | NotebookDocumentFilterPattern

lsprotocol.types.TextDocumentContentChangeEvent

An event describing a change to a text document. If only a text is provided it is considered to be the full content of the document.

alias of TextDocumentContentChangePartial | TextDocumentContentChangeWholeDocument

lsprotocol.types.TextDocumentFilter

A document filter denotes a document by different properties like the languageId language, the {@link Uri.scheme scheme} of its resource, or a glob-pattern that is applied to the fileName path.

Glob patterns can have the following syntax:

  • * to match one or more characters in a path segment

  • ? to match on one character in a path segment

  • ** to match any number of path segments, including none

  • {} to group sub patterns into an OR expression. (e.g. **/*.{ts,js} matches all TypeScript and JavaScript files)

  • [] to declare a range of characters to match in a path segment (e.g., example.[0-9] to match on example.0, example.1, …)

  • [!...] to negate a range of characters to match in a path segment (e.g., example.[!0-9] to match on example.a, example.b, but not example.0)

@sample A language filter that applies to typescript files on disk: { language: 'typescript', scheme: 'file' } @sample A language filter that applies to all package.json paths: { language: 'json', pattern: '**package.json' }

LSP v3.17.0

alias of TextDocumentFilterLanguage | TextDocumentFilterScheme | TextDocumentFilterPattern

lsprotocol.types.WorkspaceDocumentDiagnosticReport

A workspace diagnostic document report.

LSP v3.17.0

alias of WorkspaceFullDocumentDiagnosticReport | WorkspaceUnchangedDocumentDiagnosticReport