Clients

class pygls.lsp.client.BaseLanguageClient(name, version, protocol_cls=<class 'pygls.protocol.language_server.LanguageServerProtocol'>, converter_factory=<function default_converter>, **kwargs)
Parameters:
  • name (str) –

  • version (str) –

call_hierarchy_incoming_calls(params, callback=None)

Make a callHierarchy/incomingCalls request.

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

LSP v3.16.0

Parameters:
Return type:

Future

async call_hierarchy_incoming_calls_async(params)

Make a callHierarchy/incomingCalls request.

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

LSP v3.16.0

Parameters:

params (CallHierarchyIncomingCallsParams) –

Return type:

Optional[List[CallHierarchyIncomingCall]]

call_hierarchy_outgoing_calls(params, callback=None)

Make a callHierarchy/outgoingCalls request.

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

LSP v3.16.0

Parameters:
Return type:

Future

async call_hierarchy_outgoing_calls_async(params)

Make a callHierarchy/outgoingCalls request.

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

LSP v3.16.0

Parameters:

params (CallHierarchyOutgoingCallsParams) –

Return type:

Optional[List[CallHierarchyOutgoingCall]]

cancel_request(params)

Send a $/cancelRequest notification.

Parameters:

params (CancelParams) –

Return type:

None

code_action_resolve(params, callback=None)

Make a codeAction/resolve request.

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:
Return type:

Future

async code_action_resolve_async(params)

Make a codeAction/resolve request.

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:

params (CodeAction) –

Return type:

CodeAction

code_lens_resolve(params, callback=None)

Make a codeLens/resolve request.

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

Parameters:
Return type:

Future

async code_lens_resolve_async(params)

Make a codeLens/resolve request.

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

Parameters:

params (CodeLens) –

Return type:

CodeLens

completion_item_resolve(params, callback=None)

Make a completionItem/resolve request.

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:
Return type:

Future

async completion_item_resolve_async(params)

Make a completionItem/resolve request.

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:

params (CompletionItem) –

Return type:

CompletionItem

Make a documentLink/resolve request.

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:
Return type:

Future

Make a documentLink/resolve request.

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:

params (DocumentLink) –

Return type:

DocumentLink

exit(params)

Send a exit notification.

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

Parameters:

params (None) –

Return type:

None

initialize(params, callback=None)

Make a initialize request.

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:
Return type:

Future

async initialize_async(params)

Make a initialize request.

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:

params (InitializeParams) –

Return type:

InitializeResult

initialized(params)

Send a initialized notification.

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:

params (InitializedParams) –

Return type:

None

inlay_hint_resolve(params, callback=None)

Make a inlayHint/resolve request.

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:
Return type:

Future

async inlay_hint_resolve_async(params)

Make a inlayHint/resolve request.

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:

params (InlayHint) –

Return type:

InlayHint

notebook_document_did_change(params)

Send a notebookDocument/didChange notification.

Parameters:

params (DidChangeNotebookDocumentParams) –

Return type:

None

notebook_document_did_close(params)

Send a notebookDocument/didClose notification.

A notification sent when a notebook closes.

LSP v3.17.0

Parameters:

params (DidCloseNotebookDocumentParams) –

Return type:

None

notebook_document_did_open(params)

Send a notebookDocument/didOpen notification.

A notification sent when a notebook opens.

LSP v3.17.0

Parameters:

params (DidOpenNotebookDocumentParams) –

Return type:

None

notebook_document_did_save(params)

Send a notebookDocument/didSave notification.

A notification sent when a notebook document is saved.

LSP v3.17.0

Parameters:

params (DidSaveNotebookDocumentParams) –

Return type:

None

progress(params)

Send a $/progress notification.

Parameters:

params (ProgressParams) –

Return type:

None

set_trace(params)

Send a $/setTrace notification.

Parameters:

params (SetTraceParams) –

Return type:

None

shutdown(params, callback=None)

Make a shutdown request.

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:
Return type:

Future

async shutdown_async(params)

Make a shutdown request.

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:

params (None) –

Return type:

None

text_document_code_action(params, callback=None)

Make a textDocument/codeAction request.

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

Parameters:
Return type:

Future

async text_document_code_action_async(params)

Make a textDocument/codeAction request.

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

Parameters:

params (CodeActionParams) –

Return type:

Optional[List[Union[Command, CodeAction]]]

text_document_code_lens(params, callback=None)

Make a textDocument/codeLens request.

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

Parameters:
Return type:

Future

async text_document_code_lens_async(params)

Make a textDocument/codeLens request.

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

Parameters:

params (CodeLensParams) –

Return type:

Optional[List[CodeLens]]

text_document_color_presentation(params, callback=None)

Make a textDocument/colorPresentation request.

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:
Return type:

Future

async text_document_color_presentation_async(params)

Make a textDocument/colorPresentation request.

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:

params (ColorPresentationParams) –

Return type:

List[ColorPresentation]

text_document_completion(params, callback=None)

Make a textDocument/completion request.

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:
Return type:

Future

async text_document_completion_async(params)

Make a textDocument/completion request.

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:

params (CompletionParams) –

Return type:

Optional[Union[List[CompletionItem], CompletionList]]

text_document_declaration(params, callback=None)

Make a textDocument/declaration request.

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:
Return type:

Future

async text_document_declaration_async(params)

Make a textDocument/declaration request.

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:

params (DeclarationParams) –

Return type:

Optional[Union[Location, List[Location], List[LocationLink]]]

text_document_definition(params, callback=None)

Make a textDocument/definition request.

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:
Return type:

Future

async text_document_definition_async(params)

Make a textDocument/definition request.

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:

params (DefinitionParams) –

Return type:

Optional[Union[Location, List[Location], List[LocationLink]]]

text_document_diagnostic(params, callback=None)

Make a textDocument/diagnostic request.

The document diagnostic request definition.

LSP v3.17.0

Parameters:
Return type:

Future

async text_document_diagnostic_async(params)

Make a textDocument/diagnostic request.

The document diagnostic request definition.

LSP v3.17.0

Parameters:

params (DocumentDiagnosticParams) –

Return type:

Union[RelatedFullDocumentDiagnosticReport, RelatedUnchangedDocumentDiagnosticReport]

text_document_did_change(params)

Send a textDocument/didChange notification.

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

Parameters:

params (DidChangeTextDocumentParams) –

Return type:

None

text_document_did_close(params)

Send a textDocument/didClose notification.

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:

params (DidCloseTextDocumentParams) –

Return type:

None

text_document_did_open(params)

Send a textDocument/didOpen notification.

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:

params (DidOpenTextDocumentParams) –

Return type:

None

text_document_did_save(params)

Send a textDocument/didSave notification.

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

Parameters:

params (DidSaveTextDocumentParams) –

Return type:

None

text_document_document_color(params, callback=None)

Make a textDocument/documentColor request.

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:
Return type:

Future

async text_document_document_color_async(params)

Make a textDocument/documentColor request.

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:

params (DocumentColorParams) –

Return type:

List[ColorInformation]

text_document_document_highlight(params, callback=None)

Make a textDocument/documentHighlight request.

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:
Return type:

Future

async text_document_document_highlight_async(params)

Make a textDocument/documentHighlight request.

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:

params (DocumentHighlightParams) –

Return type:

Optional[List[DocumentHighlight]]

Make a textDocument/documentLink request.

A request to provide document links

Parameters:
Return type:

Future

Make a textDocument/documentLink request.

A request to provide document links

Parameters:

params (DocumentLinkParams) –

Return type:

Optional[List[DocumentLink]]

text_document_document_symbol(params, callback=None)

Make a textDocument/documentSymbol request.

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:
Return type:

Future

async text_document_document_symbol_async(params)

Make a textDocument/documentSymbol request.

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:

params (DocumentSymbolParams) –

Return type:

Optional[Union[List[SymbolInformation], List[DocumentSymbol]]]

text_document_folding_range(params, callback=None)

Make a textDocument/foldingRange request.

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:
Return type:

Future

async text_document_folding_range_async(params)

Make a textDocument/foldingRange request.

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:

params (FoldingRangeParams) –

Return type:

Optional[List[FoldingRange]]

text_document_formatting(params, callback=None)

Make a textDocument/formatting request.

A request to format a whole document.

Parameters:
Return type:

Future

async text_document_formatting_async(params)

Make a textDocument/formatting request.

A request to format a whole document.

Parameters:

params (DocumentFormattingParams) –

Return type:

Optional[List[TextEdit]]

text_document_hover(params, callback=None)

Make a textDocument/hover request.

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:
Return type:

Future

async text_document_hover_async(params)

Make a textDocument/hover request.

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:

params (HoverParams) –

Return type:

Optional[Hover]

text_document_implementation(params, callback=None)

Make a textDocument/implementation request.

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:
Return type:

Future

async text_document_implementation_async(params)

Make a textDocument/implementation request.

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:

params (ImplementationParams) –

Return type:

Optional[Union[Location, List[Location], List[LocationLink]]]

text_document_inlay_hint(params, callback=None)

Make a textDocument/inlayHint request.

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:
Return type:

Future

async text_document_inlay_hint_async(params)

Make a textDocument/inlayHint request.

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:

params (InlayHintParams) –

Return type:

Optional[List[InlayHint]]

text_document_inline_completion(params, callback=None)

Make a textDocument/inlineCompletion request.

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:
Return type:

Future

async text_document_inline_completion_async(params)

Make a textDocument/inlineCompletion request.

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:

params (InlineCompletionParams) –

Return type:

Optional[Union[InlineCompletionList, List[InlineCompletionItem]]]

text_document_inline_value(params, callback=None)

Make a textDocument/inlineValue request.

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:
Return type:

Future

async text_document_inline_value_async(params)

Make a textDocument/inlineValue request.

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:

params (InlineValueParams) –

Return type:

Optional[List[Union[InlineValueText, InlineValueVariableLookup, InlineValueEvaluatableExpression]]]

text_document_linked_editing_range(params, callback=None)

Make a textDocument/linkedEditingRange request.

A request to provide ranges that can be edited together.

LSP v3.16.0

Parameters:
Return type:

Future

async text_document_linked_editing_range_async(params)

Make a textDocument/linkedEditingRange request.

A request to provide ranges that can be edited together.

LSP v3.16.0

Parameters:

params (LinkedEditingRangeParams) –

Return type:

Optional[LinkedEditingRanges]

text_document_moniker(params, callback=None)

Make a textDocument/moniker request.

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:
Return type:

Future

async text_document_moniker_async(params)

Make a textDocument/moniker request.

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:

params (MonikerParams) –

Return type:

Optional[List[Moniker]]

text_document_on_type_formatting(params, callback=None)

Make a textDocument/onTypeFormatting request.

A request to format a document on type.

Parameters:
Return type:

Future

async text_document_on_type_formatting_async(params)

Make a textDocument/onTypeFormatting request.

A request to format a document on type.

Parameters:

params (DocumentOnTypeFormattingParams) –

Return type:

Optional[List[TextEdit]]

text_document_prepare_call_hierarchy(params, callback=None)

Make a textDocument/prepareCallHierarchy request.

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:
Return type:

Future

async text_document_prepare_call_hierarchy_async(params)

Make a textDocument/prepareCallHierarchy request.

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:

params (CallHierarchyPrepareParams) –

Return type:

Optional[List[CallHierarchyItem]]

text_document_prepare_rename(params, callback=None)

Make a textDocument/prepareRename request.

A request to test and perform the setup necessary for a rename.

LSP v3.16 - support for default behavior

Parameters:
Return type:

Future

async text_document_prepare_rename_async(params)

Make a textDocument/prepareRename request.

A request to test and perform the setup necessary for a rename.

LSP v3.16 - support for default behavior

Parameters:

params (PrepareRenameParams) –

Return type:

Optional[Union[Range, PrepareRenameResult_Type1, PrepareRenameResult_Type2]]

text_document_prepare_type_hierarchy(params, callback=None)

Make a textDocument/prepareTypeHierarchy request.

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:
Return type:

Future

async text_document_prepare_type_hierarchy_async(params)

Make a textDocument/prepareTypeHierarchy request.

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:

params (TypeHierarchyPrepareParams) –

Return type:

Optional[List[TypeHierarchyItem]]

text_document_range_formatting(params, callback=None)

Make a textDocument/rangeFormatting request.

A request to format a range in a document.

Parameters:
Return type:

Future

async text_document_range_formatting_async(params)

Make a textDocument/rangeFormatting request.

A request to format a range in a document.

Parameters:

params (DocumentRangeFormattingParams) –

Return type:

Optional[List[TextEdit]]

text_document_ranges_formatting(params, callback=None)

Make a textDocument/rangesFormatting request.

A request to format ranges in a document.

LSP v3.18.0 @proposed

Parameters:
Return type:

Future

async text_document_ranges_formatting_async(params)

Make a textDocument/rangesFormatting request.

A request to format ranges in a document.

LSP v3.18.0 @proposed

Parameters:

params (DocumentRangesFormattingParams) –

Return type:

Optional[List[TextEdit]]

text_document_references(params, callback=None)

Make a textDocument/references request.

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:
Return type:

Future

async text_document_references_async(params)

Make a textDocument/references request.

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:

params (ReferenceParams) –

Return type:

Optional[List[Location]]

text_document_rename(params, callback=None)

Make a textDocument/rename request.

A request to rename a symbol.

Parameters:
Return type:

Future

async text_document_rename_async(params)

Make a textDocument/rename request.

A request to rename a symbol.

Parameters:

params (RenameParams) –

Return type:

Optional[WorkspaceEdit]

text_document_selection_range(params, callback=None)

Make a textDocument/selectionRange request.

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:
Return type:

Future

async text_document_selection_range_async(params)

Make a textDocument/selectionRange request.

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:

params (SelectionRangeParams) –

Return type:

Optional[List[SelectionRange]]

text_document_semantic_tokens_full(params, callback=None)

Make a textDocument/semanticTokens/full request.

LSP v3.16.0

Parameters:
Return type:

Future

async text_document_semantic_tokens_full_async(params)

Make a textDocument/semanticTokens/full request.

LSP v3.16.0

Parameters:

params (SemanticTokensParams) –

Return type:

Optional[SemanticTokens]

text_document_semantic_tokens_full_delta(params, callback=None)

Make a textDocument/semanticTokens/full/delta request.

LSP v3.16.0

Parameters:
Return type:

Future

async text_document_semantic_tokens_full_delta_async(params)

Make a textDocument/semanticTokens/full/delta request.

LSP v3.16.0

Parameters:

params (SemanticTokensDeltaParams) –

Return type:

Optional[Union[SemanticTokens, SemanticTokensDelta]]

text_document_semantic_tokens_range(params, callback=None)

Make a textDocument/semanticTokens/range request.

LSP v3.16.0

Parameters:
Return type:

Future

async text_document_semantic_tokens_range_async(params)

Make a textDocument/semanticTokens/range request.

LSP v3.16.0

Parameters:

params (SemanticTokensRangeParams) –

Return type:

Optional[SemanticTokens]

text_document_signature_help(params, callback=None)

Make a textDocument/signatureHelp request.

Parameters:
Return type:

Future

async text_document_signature_help_async(params)

Make a textDocument/signatureHelp request.

Parameters:

params (SignatureHelpParams) –

Return type:

Optional[SignatureHelp]

text_document_type_definition(params, callback=None)

Make a textDocument/typeDefinition request.

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:
Return type:

Future

async text_document_type_definition_async(params)

Make a textDocument/typeDefinition request.

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:

params (TypeDefinitionParams) –

Return type:

Optional[Union[Location, List[Location], List[LocationLink]]]

text_document_will_save(params)

Send a textDocument/willSave notification.

A document will save notification is sent from the client to the server before the document is actually saved.

Parameters:

params (WillSaveTextDocumentParams) –

Return type:

None

text_document_will_save_wait_until(params, callback=None)

Make a textDocument/willSaveWaitUntil request.

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:
Return type:

Future

async text_document_will_save_wait_until_async(params)

Make a textDocument/willSaveWaitUntil request.

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:

params (WillSaveTextDocumentParams) –

Return type:

Optional[List[TextEdit]]

type_hierarchy_subtypes(params, callback=None)

Make a typeHierarchy/subtypes request.

A request to resolve the subtypes for a given TypeHierarchyItem .

LSP v3.17.0

Parameters:
Return type:

Future

async type_hierarchy_subtypes_async(params)

Make a typeHierarchy/subtypes request.

A request to resolve the subtypes for a given TypeHierarchyItem .

LSP v3.17.0

Parameters:

params (TypeHierarchySubtypesParams) –

Return type:

Optional[List[TypeHierarchyItem]]

type_hierarchy_supertypes(params, callback=None)

Make a typeHierarchy/supertypes request.

A request to resolve the supertypes for a given TypeHierarchyItem .

LSP v3.17.0

Parameters:
Return type:

Future

async type_hierarchy_supertypes_async(params)

Make a typeHierarchy/supertypes request.

A request to resolve the supertypes for a given TypeHierarchyItem .

LSP v3.17.0

Parameters:

params (TypeHierarchySupertypesParams) –

Return type:

Optional[List[TypeHierarchyItem]]

window_work_done_progress_cancel(params)

Send a window/workDoneProgress/cancel notification.

The window/workDoneProgress/cancel notification is sent from the client to the server to cancel a progress initiated on the server side.

Parameters:

params (WorkDoneProgressCancelParams) –

Return type:

None

workspace_diagnostic(params, callback=None)

Make a workspace/diagnostic request.

The workspace diagnostic request definition.

LSP v3.17.0

Parameters:
Return type:

Future

async workspace_diagnostic_async(params)

Make a workspace/diagnostic request.

The workspace diagnostic request definition.

LSP v3.17.0

Parameters:

params (WorkspaceDiagnosticParams) –

Return type:

WorkspaceDiagnosticReport

workspace_did_change_configuration(params)

Send a workspace/didChangeConfiguration notification.

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:

params (DidChangeConfigurationParams) –

Return type:

None

workspace_did_change_watched_files(params)

Send a workspace/didChangeWatchedFiles notification.

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:

params (DidChangeWatchedFilesParams) –

Return type:

None

workspace_did_change_workspace_folders(params)

Send a workspace/didChangeWorkspaceFolders notification.

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

Parameters:

params (DidChangeWorkspaceFoldersParams) –

Return type:

None

workspace_did_create_files(params)

Send a workspace/didCreateFiles notification.

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:

params (CreateFilesParams) –

Return type:

None

workspace_did_delete_files(params)

Send a workspace/didDeleteFiles notification.

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:

params (DeleteFilesParams) –

Return type:

None

workspace_did_rename_files(params)

Send a workspace/didRenameFiles notification.

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:

params (RenameFilesParams) –

Return type:

None

workspace_execute_command(params, callback=None)

Make a workspace/executeCommand request.

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:
Return type:

Future

async workspace_execute_command_async(params)

Make a workspace/executeCommand request.

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:

params (ExecuteCommandParams) –

Return type:

Optional[Any]

workspace_symbol(params, callback=None)

Make a workspace/symbol request.

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:
Return type:

Future

async workspace_symbol_async(params)

Make a workspace/symbol request.

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:

params (WorkspaceSymbolParams) –

Return type:

Optional[Union[List[SymbolInformation], List[WorkspaceSymbol]]]

workspace_symbol_resolve(params, callback=None)

Make a workspaceSymbol/resolve request.

A request to resolve the range inside the workspace symbol’s location.

LSP v3.17.0

Parameters:
Return type:

Future

async workspace_symbol_resolve_async(params)

Make a workspaceSymbol/resolve request.

A request to resolve the range inside the workspace symbol’s location.

LSP v3.17.0

Parameters:

params (WorkspaceSymbol) –

Return type:

WorkspaceSymbol

workspace_will_create_files(params, callback=None)

Make a workspace/willCreateFiles request.

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:
Return type:

Future

async workspace_will_create_files_async(params)

Make a workspace/willCreateFiles request.

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:

params (CreateFilesParams) –

Return type:

Optional[WorkspaceEdit]

workspace_will_delete_files(params, callback=None)

Make a workspace/willDeleteFiles request.

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:
Return type:

Future

async workspace_will_delete_files_async(params)

Make a workspace/willDeleteFiles request.

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:

params (DeleteFilesParams) –

Return type:

Optional[WorkspaceEdit]

workspace_will_rename_files(params, callback=None)

Make a workspace/willRenameFiles request.

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:
Return type:

Future

async workspace_will_rename_files_async(params)

Make a workspace/willRenameFiles request.

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:

params (RenameFilesParams) –

Return type:

Optional[WorkspaceEdit]

class pygls.client.JsonRPCClient(protocol_cls=<class 'pygls.protocol.json_rpc.JsonRPCProtocol'>, converter_factory=<function default_converter>)

Base JSON-RPC client.

Parameters:
feature(feature_name, options=None)

Decorator used to register LSP features.

Example

import logging
from pygls.client import JsonRPCClient

ls = JsonRPCClient()

@ls.feature('window/logMessage')
def completions(ls, params):
    logging.info("%s", params.message)
Parameters:
report_server_error(error, source)

Called when the server does something unexpected e.g. respond with malformed JSON.

Parameters:
  • error (Exception) –

  • source (Union[PyglsError, JsonRpcException]) –

async server_exit(server)

Called when the server process exits.

Parameters:

server (Process) –

async start_io(cmd, *args, **kwargs)

Start the given server and communicate with it over stdio.

Parameters:

cmd (str) –

property stopped: bool

Return True if the client has been stopped.