diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 505ceac..837c51b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -10,7 +10,7 @@ repos: - id: trailing-whitespace - repo: https://github.com/psf/black - rev: 23.12.1 + rev: 24.1.1 hooks: - id: black diff --git a/docs/capabilities/general.rst b/docs/capabilities/general.rst new file mode 100644 index 0000000..e0b0c70 --- /dev/null +++ b/docs/capabilities/general.rst @@ -0,0 +1,30 @@ +``general`` +=========== + +.. default-domain:: capabilities + +.. values-table:: general.position_encodings + :value-set: PositionEncodingKind + +``staleRequestSupport`` +----------------------- + +.. bool-table:: general.stale_request_support.cancel + +.. values-table:: general.stale_request_support.retry_on_content_modified + +``regularExpressions`` +---------------------- + +.. values-table:: general.regular_expressions.engine + +.. values-table:: general.regular_expressions.version + +``markdown`` +------------ + +.. values-table:: general.markdown.parser + +.. values-table:: general.markdown.version + +.. values-table:: general.markdown.allowed_tags diff --git a/docs/capabilities/notebook-document.rst b/docs/capabilities/notebook-document.rst new file mode 100644 index 0000000..63218c0 --- /dev/null +++ b/docs/capabilities/notebook-document.rst @@ -0,0 +1,11 @@ +``notebook`` +============ + +.. default-domain:: capabilities + +``synchronization`` +------------------- + +.. bool-table:: notebook_document.synchronization.dynamic_registration + +.. bool-table:: notebook_document.synchronization.execution_summary_support diff --git a/docs/capabilities/text-document.rst b/docs/capabilities/text-document.rst index 2c9beb9..03533b9 100644 --- a/docs/capabilities/text-document.rst +++ b/docs/capabilities/text-document.rst @@ -1,5 +1,5 @@ -Text Document -============= +``textDocument`` +================ .. toctree:: :maxdepth: 1 diff --git a/docs/capabilities/text-document/call-hierachy.rst b/docs/capabilities/text-document/call-hierachy.rst new file mode 100644 index 0000000..ac53858 --- /dev/null +++ b/docs/capabilities/text-document/call-hierachy.rst @@ -0,0 +1,8 @@ +``callHierarchy`` +================= + +Capabilities relating to the :lsp:`textDocument/prepareCallHierarchy` request. + +.. default-domain:: capabilities + +.. bool-table:: text_document.call_hierarchy.dynamic_registration diff --git a/docs/capabilities/text-document/code-action.rst b/docs/capabilities/text-document/code-action.rst index 7e0d351..0390f76 100644 --- a/docs/capabilities/text-document/code-action.rst +++ b/docs/capabilities/text-document/code-action.rst @@ -1,29 +1,21 @@ -``textDocument/codeAction`` -=========================== +``codeAction`` +============== Capabilities relating to the :lsp:`textDocument/codeAction` request. -Dynamic Registration --------------------- +.. default-domain:: capabilities -.. capabilities:bool-table:: text_document.code_action.dynamic_registration +.. bool-table:: text_document.code_action.dynamic_registration -Honors Change Annotations -------------------------- +.. values-table:: text_document.code_action.code_action_literal_support.code_action_kind.value_set + :value-set: CodeActionKind -.. capabilities:bool-table:: text_document.code_action.honors_change_annotations +.. bool-table:: text_document.code_action.is_preferred_support -``CodeAction.isPreferred`` --------------------------- +.. bool-table:: text_document.code_action.disabled_support -.. capabilities:bool-table:: text_document.code_action.is_preferred_support +.. bool-table:: text_document.code_action.data_support -``CodeAction.disabled`` ------------------------ +.. values-table:: text_document.code_action.resolve_support.properties -.. capabilities:bool-table:: text_document.code_action.disabled_support - -``CodeAction.data`` -------------------- - -.. capabilities:bool-table:: text_document.code_action.data_support +.. bool-table:: text_document.code_action.honors_change_annotations diff --git a/docs/capabilities/text-document/code-lens.rst b/docs/capabilities/text-document/code-lens.rst index 4371683..4126526 100644 --- a/docs/capabilities/text-document/code-lens.rst +++ b/docs/capabilities/text-document/code-lens.rst @@ -1,9 +1,8 @@ -``textDocument/codeLens`` -========================= +``codeLens`` +============ Capabilities relating to the :lsp:`textDocument/codeLens` request. -Dynamic Registration --------------------- +.. default-domain:: capabilities -.. capabilities:bool-table:: text_document.code_lens.dynamic_registration +.. bool-table:: text_document.code_lens.dynamic_registration diff --git a/docs/capabilities/text-document/completion.rst b/docs/capabilities/text-document/completion.rst index c93d599..52ac463 100644 --- a/docs/capabilities/text-document/completion.rst +++ b/docs/capabilities/text-document/completion.rst @@ -1,40 +1,60 @@ -``textDocument/completion`` -=========================== - -Dynamic Registration --------------------- +``completion`` +============== Capabilities relating to the :lsp:`textDocument/completion` request. -.. capabilities:bool-table:: text_document.completion.dynamic_registration +.. default-domain:: capabilities + +.. bool-table:: text_document.completion.dynamic_registration + +.. bool-table:: text_document.completion.context_support + +.. values-table:: text_document.completion.insert_text_mode + +``completionItem`` +------------------ + +.. bool-table:: text_document.completion.completion_item.snippet_support + +.. bool-table:: text_document.completion.completion_item.commit_characters_support + +.. values-table:: text_document.completion.completion_item.documentation_format + :value-set: MarkupKind + +.. bool-table:: text_document.completion.completion_item.deprecated_support + +.. bool-table:: text_document.completion.completion_item.preselect_support + +.. bool-table:: text_document.completion.completion_item.insert_replace_support +.. bool-table:: text_document.completion.completion_item.label_details_support -``CompletionItem.commitCharactersSupport`` ------------------------------------------- +``insertTextModeSupport`` +^^^^^^^^^^^^^^^^^^^^^^^^^ -.. capabilities:bool-table:: text_document.completion.completion_item.commit_characters_support +.. values-table:: text_document.completion.completion_item.insert_text_mode_support.value_set + :value-set: InsertTextMode -``CompletionItem.deprecatedSupport`` ------------------------------------- +``resolveSupport`` +^^^^^^^^^^^^^^^^^^ -.. capabilities:bool-table:: text_document.completion.completion_item.deprecated_support +.. values-table:: text_document.completion.completion_item.resolve_support.properties -``CompletionItem.insertReplaceSupport`` ---------------------------------------- -.. capabilities:bool-table:: text_document.completion.completion_item.insert_replace_support +``tagSupport`` +^^^^^^^^^^^^^^ -``CompletionItem.labelDetailsSupport`` --------------------------------------- +.. values-table:: text_document.completion.completion_item.tag_support.value_set + :value-set: CompletionItemTag -.. capabilities:bool-table:: text_document.completion.completion_item.label_details_support -``CompletionItem.preselectSupport`` ------------------------------------ +``completionItemKind`` +---------------------- -.. capabilities:bool-table:: text_document.completion.completion_item.preselect_support +.. values-table:: text_document.completion.completion_item_kind.value_set + :value-set: CompletionItemKind -``CompletionItem.snippetSupport`` ---------------------------------- +``completionList`` +------------------ -.. capabilities:bool-table:: text_document.completion.completion_item.snippet_support +.. values-table:: text_document.completion.completion_list.item_defaults diff --git a/docs/capabilities/text-document/declaration.rst b/docs/capabilities/text-document/declaration.rst index a13f91b..f8b5461 100644 --- a/docs/capabilities/text-document/declaration.rst +++ b/docs/capabilities/text-document/declaration.rst @@ -1,14 +1,10 @@ -``textDocument/declaration`` -============================ +``declaration`` +=============== Capabilities relating to the :lsp:`textDocument/declaration` request. -Dynamic Registration --------------------- +.. default-domain:: capabilities -.. capabilities:bool-table:: text_document.declaration.dynamic_registration +.. bool-table:: text_document.declaration.dynamic_registration -Link Support ------------- - -.. capabilities:bool-table:: text_document.declaration.link_support +.. bool-table:: text_document.declaration.link_support diff --git a/docs/capabilities/text-document/definition.rst b/docs/capabilities/text-document/definition.rst index 5948986..b7d8e56 100644 --- a/docs/capabilities/text-document/definition.rst +++ b/docs/capabilities/text-document/definition.rst @@ -1,14 +1,10 @@ -``textDocument/definition`` -============================ +``definition`` +============== Capabilities relating to the :lsp:`textDocument/definition` request. -Dynamic Registration --------------------- +.. default-domain:: capabilities -.. capabilities:bool-table:: text_document.definition.dynamic_registration +.. bool-table:: text_document.definition.dynamic_registration -Link Support ------------- - -.. capabilities:bool-table:: text_document.definition.link_support +.. bool-table:: text_document.definition.link_support diff --git a/docs/capabilities/text-document/diagnostic.rst b/docs/capabilities/text-document/diagnostic.rst index 8759012..8df72f0 100644 --- a/docs/capabilities/text-document/diagnostic.rst +++ b/docs/capabilities/text-document/diagnostic.rst @@ -1,14 +1,10 @@ -``textDocument/diagnostic`` -=========================== +``diagnostic`` +============== Capabilities relating to the :lsp:`textDocument/diagnostic` request. -Dynamic Registration --------------------- +.. default-domain:: capabilities -.. capabilities:bool-table:: text_document.diagnostic.dynamic_registration +.. bool-table:: text_document.diagnostic.dynamic_registration -Related Document Support ------------------------- - -.. capabilities:bool-table:: text_document.diagnostic.related_document_support +.. bool-table:: text_document.diagnostic.related_document_support diff --git a/docs/capabilities/text-document/document-color.rst b/docs/capabilities/text-document/document-color.rst index fed42d6..357400b 100644 --- a/docs/capabilities/text-document/document-color.rst +++ b/docs/capabilities/text-document/document-color.rst @@ -1,9 +1,8 @@ -``textDocument/documentColor`` -============================== +``documentColor`` +================= Capabilities relating to the :lsp:`textDocument/documentColor` request. -Dynamic Registration --------------------- +.. default-domain:: capabilities -.. capabilities:bool-table:: text_document.color_provider.dynamic_registration +.. bool-table:: text_document.color_provider.dynamic_registration diff --git a/docs/capabilities/text-document/document-highlight.rst b/docs/capabilities/text-document/document-highlight.rst index 78db079..638fcd0 100644 --- a/docs/capabilities/text-document/document-highlight.rst +++ b/docs/capabilities/text-document/document-highlight.rst @@ -1,9 +1,8 @@ -``textDocument/documentHighlight`` -================================== +``documentHighlight`` +===================== Capabilities relating to the :lsp:`textDocument/documentHighlight` request. -Dynamic Registration --------------------- +.. default-domain:: capabilities -.. capabilities:bool-table:: text_document.document_highlight.dynamic_registration +.. bool-table:: text_document.document_highlight.dynamic_registration diff --git a/docs/capabilities/text-document/document-link.rst b/docs/capabilities/text-document/document-link.rst index b42551f..315b5e0 100644 --- a/docs/capabilities/text-document/document-link.rst +++ b/docs/capabilities/text-document/document-link.rst @@ -1,14 +1,10 @@ -``textDocument/documentLink`` -================================== +``documentLink`` +================ Capabilities relating to the :lsp:`textDocument/documentLink` request. -Dynamic Registration --------------------- +.. default-domain:: capabilities -.. capabilities:bool-table:: text_document.document_link.dynamic_registration +.. bool-table:: text_document.document_link.dynamic_registration -Tooltip Support ---------------- - -.. capabilities:bool-table:: text_document.document_link.tooltip_support +.. bool-table:: text_document.document_link.tooltip_support diff --git a/docs/capabilities/text-document/document-symbols.rst b/docs/capabilities/text-document/document-symbols.rst index 7b90608..c6bdc51 100644 --- a/docs/capabilities/text-document/document-symbols.rst +++ b/docs/capabilities/text-document/document-symbols.rst @@ -1,19 +1,25 @@ -``textDocument/documentSymbols`` -================================ +``documentSymbols`` +=================== Capabilities relating to the :lsp:`textDocument/documentSymbols` request. -Dynamic Registration --------------------- +.. default-domain:: capabilities -.. capabilities:bool-table:: text_document.document_symbol.dynamic_registration +.. bool-table:: text_document.document_symbol.dynamic_registration -Hierarchical Symbols --------------------- +.. bool-table:: text_document.document_symbol.hierarchical_document_symbol_support -.. capabilities:bool-table:: text_document.document_symbol.hierarchical_document_symbol_support +.. bool-table:: text_document.document_symbol.label_support -Label Support -------------- -.. capabilities:bool-table:: text_document.document_symbol.label_support +``symbolKind`` +-------------- + +.. values-table:: text_document.document_symbol.symbol_kind.value_set + :value-set: SymbolKind + +``tagSupport`` +-------------- + +.. values-table:: text_document.document_symbol.tag_support.value_set + :value-set: SymbolTag diff --git a/docs/capabilities/text-document/folding-range.rst b/docs/capabilities/text-document/folding-range.rst index fb385d3..8ce823f 100644 --- a/docs/capabilities/text-document/folding-range.rst +++ b/docs/capabilities/text-document/folding-range.rst @@ -1,14 +1,24 @@ -``textDocument/foldingRange`` -============================= +``foldingRange`` +================ Capabilities relating to the :lsp:`textDocument/foldingRange` request. -Dynamic Registration --------------------- +.. default-domain:: capabilities + +.. bool-table:: text_document.folding_range.dynamic_registration + +.. values-table:: text_document.folding_range.range_limit + +.. bool-table:: text_document.folding_range.line_folding_only -.. capabilities:bool-table:: text_document.folding_range.dynamic_registration +``foldingRange`` +---------------- -Line Folding Only ------------------ +.. bool-table:: text_document.folding_range.folding_range.collapsed_text + + +``foldingRangeKind`` +-------------------- -.. capabilities:bool-table:: text_document.folding_range.line_folding_only +.. values-table:: text_document.folding_range.folding_range_kind.value_set + :value-set: FoldingRangeKind diff --git a/docs/capabilities/text-document/formatting.rst b/docs/capabilities/text-document/formatting.rst index 36cb558..c4eed91 100644 --- a/docs/capabilities/text-document/formatting.rst +++ b/docs/capabilities/text-document/formatting.rst @@ -1,9 +1,8 @@ -``textDocument/formatting`` -============================= +``formatting`` +============== Capabilities relating to the :lsp:`textDocument/formatting` request. -Dynamic Registration --------------------- +.. default-domain:: capabilities -.. capabilities:bool-table:: text_document.formatting.dynamic_registration +.. bool-table:: text_document.formatting.dynamic_registration diff --git a/docs/capabilities/text-document/hover.rst b/docs/capabilities/text-document/hover.rst index fc5ab6e..3400b0b 100644 --- a/docs/capabilities/text-document/hover.rst +++ b/docs/capabilities/text-document/hover.rst @@ -1,9 +1,11 @@ -``textDocument/hover`` -====================== +``hover`` +========= Capabilities relating to the :lsp:`textDocument/hover` request. -Dynamic Registration --------------------- +.. default-domain:: capabilities -.. capabilities:bool-table:: text_document.hover.dynamic_registration +.. bool-table:: text_document.hover.dynamic_registration + +.. values-table:: text_document.hover.content_format + :value-set: MarkupKind diff --git a/docs/capabilities/text-document/implementation.rst b/docs/capabilities/text-document/implementation.rst index 2855024..4b9161f 100644 --- a/docs/capabilities/text-document/implementation.rst +++ b/docs/capabilities/text-document/implementation.rst @@ -1,14 +1,10 @@ -``textDocument/implementation`` -=============================== +``implementation`` +================== Capabilities relating to the :lsp:`textDocument/implementation` request. -Dynamic Registration --------------------- +.. default-domain:: capabilities -.. capabilities:bool-table:: text_document.implementation.dynamic_registration +.. bool-table:: text_document.implementation.dynamic_registration -Link Support ------------- - -.. capabilities:bool-table:: text_document.implementation.link_support +.. bool-table:: text_document.implementation.link_support diff --git a/docs/capabilities/text-document/inlay-hint.rst b/docs/capabilities/text-document/inlay-hint.rst index 1b9d9c2..579b6b1 100644 --- a/docs/capabilities/text-document/inlay-hint.rst +++ b/docs/capabilities/text-document/inlay-hint.rst @@ -1,9 +1,13 @@ -``textDocument/inlayHint`` -========================== +``inlayHint`` +============= Capabilities relating to the :lsp:`textDocument/inlayHint` request. -Dynamic Registration --------------------- +.. default-domain:: capabilities -.. capabilities:bool-table:: text_document.inlay_hint.dynamic_registration +.. bool-table:: text_document.inlay_hint.dynamic_registration + +``resolveSupport`` +------------------ + +.. values-table:: text_document.inlay_hint.resolve_support.properties diff --git a/docs/capabilities/text-document/inline-value.rst b/docs/capabilities/text-document/inline-value.rst index 82e53e5..579de6d 100644 --- a/docs/capabilities/text-document/inline-value.rst +++ b/docs/capabilities/text-document/inline-value.rst @@ -1,9 +1,8 @@ -``textDocument/inlineValue`` -============================ +``inlineValue`` +=============== Capabilities relating to the :lsp:`textDocument/inlineValue` request. -Dynamic Registration --------------------- +.. default-domain:: capabilities -.. capabilities:bool-table:: text_document.inline_value.dynamic_registration +.. bool-table:: text_document.inline_value.dynamic_registration diff --git a/docs/capabilities/text-document/linked-editing-range.rst b/docs/capabilities/text-document/linked-editing-range.rst index 6c14a21..897215b 100644 --- a/docs/capabilities/text-document/linked-editing-range.rst +++ b/docs/capabilities/text-document/linked-editing-range.rst @@ -1,9 +1,8 @@ -``textDocument/linkedEditingRange`` -=================================== +``linkedEditingRange`` +====================== Capabilities relating to the :lsp:`textDocument/linkedEditingRange` request. -Dynamic Registration --------------------- +.. default-domain:: capabilities -.. capabilities:bool-table:: text_document.linked_editing_range.dynamic_registration +.. bool-table:: text_document.linked_editing_range.dynamic_registration diff --git a/docs/capabilities/text-document/moniker.rst b/docs/capabilities/text-document/moniker.rst index 8c961ef..4ce14c8 100644 --- a/docs/capabilities/text-document/moniker.rst +++ b/docs/capabilities/text-document/moniker.rst @@ -1,9 +1,8 @@ -``textDocument/moniker`` -======================== +``moniker`` +=========== Capabilities relating to the :lsp:`textDocument/moniker` request. -Dynamic Registration --------------------- +.. default-domain:: capabilities -.. capabilities:bool-table:: text_document.moniker.dynamic_registration +.. bool-table:: text_document.moniker.dynamic_registration diff --git a/docs/capabilities/text-document/on-type-formatting.rst b/docs/capabilities/text-document/on-type-formatting.rst index ccee49f..6693c11 100644 --- a/docs/capabilities/text-document/on-type-formatting.rst +++ b/docs/capabilities/text-document/on-type-formatting.rst @@ -1,9 +1,8 @@ -``textDocument/onTypeFormatting`` -================================= +``onTypeFormatting`` +==================== Capabilities relating to the :lsp:`textDocument/onTypeFormatting` request. -Dynamic Registration --------------------- +.. default-domain:: capabilities -.. capabilities:bool-table:: text_document.on_type_formatting.dynamic_registration +.. bool-table:: text_document.on_type_formatting.dynamic_registration diff --git a/docs/capabilities/text-document/preapare-call-hierachy.rst b/docs/capabilities/text-document/preapare-call-hierachy.rst deleted file mode 100644 index 89718e9..0000000 --- a/docs/capabilities/text-document/preapare-call-hierachy.rst +++ /dev/null @@ -1,9 +0,0 @@ -``textDocument/prepareCallHierarchy`` -===================================== - -Capabilities relating to the :lsp:`textDocument/prepareCallHierarchy` request. - -Dynamic Registration --------------------- - -.. capabilities:bool-table:: text_document.call_hierarchy.dynamic_registration diff --git a/docs/capabilities/text-document/preapare-type-hierachy.rst b/docs/capabilities/text-document/preapare-type-hierachy.rst deleted file mode 100644 index cbe8607..0000000 --- a/docs/capabilities/text-document/preapare-type-hierachy.rst +++ /dev/null @@ -1,9 +0,0 @@ -``textDocument/prepareTypeHierarchy`` -===================================== - -Capabilities relating to the :lsp:`textDocument/prepareTypeHierarchy` request. - -Dynamic Registration --------------------- - -.. capabilities:bool-table:: text_document.type_hierarchy.dynamic_registration diff --git a/docs/capabilities/text-document/publish-diagnostics.rst b/docs/capabilities/text-document/publish-diagnostics.rst index 86a36b2..49ca8f1 100644 --- a/docs/capabilities/text-document/publish-diagnostics.rst +++ b/docs/capabilities/text-document/publish-diagnostics.rst @@ -1,24 +1,20 @@ -``textDocument/publishDiagnostics`` -=================================== +``publishDiagnostics`` +====================== -Capabilities relating to the :lsp:`textDocument/publishDiagnostics` notification. +Capabilities relating to the :lsp:`textDocument/publishDiagnostics` notification -Related Information -------------------- +.. default-domain:: capabilities -.. capabilities:bool-table:: text_document.publish_diagnostics.related_information +.. bool-table:: text_document.publish_diagnostics.related_information -Version Support ---------------- +.. bool-table:: text_document.publish_diagnostics.version_support -.. capabilities:bool-table:: text_document.publish_diagnostics.version_support +.. bool-table:: text_document.publish_diagnostics.code_description_support -Code Description ----------------- +.. bool-table:: text_document.publish_diagnostics.data_support -.. capabilities:bool-table:: text_document.publish_diagnostics.code_description +``tagSupport`` +-------------- -Data Support ------------- - -.. capabilities:bool-table:: text_document.publish_diagnostics.data_support +.. values-table:: text_document.publish_diagnostics.tag_support.value_set + :value-set: DiagnosticTag diff --git a/docs/capabilities/text-document/range-formatting.rst b/docs/capabilities/text-document/range-formatting.rst index 8530156..6e81043 100644 --- a/docs/capabilities/text-document/range-formatting.rst +++ b/docs/capabilities/text-document/range-formatting.rst @@ -1,9 +1,8 @@ -``textDocument/rangeFormatting`` -================================ +``rangeFormatting`` +=================== Capabilities relating to the :lsp:`textDocument/rangeFormatting` request. -Dynamic Registration --------------------- +.. default-domain:: capabilities -.. capabilities:bool-table:: text_document.range_formatting.dynamic_registration +.. bool-table:: text_document.range_formatting.dynamic_registration diff --git a/docs/capabilities/text-document/references.rst b/docs/capabilities/text-document/references.rst index 934a69b..ae058aa 100644 --- a/docs/capabilities/text-document/references.rst +++ b/docs/capabilities/text-document/references.rst @@ -1,9 +1,8 @@ -``textDocument/references`` -=============================== +``references`` +============== Capabilities relating to the :lsp:`textDocument/references` request. -Dynamic Registration --------------------- +.. default-domain:: capabilities -.. capabilities:bool-table:: text_document.references.dynamic_registration +.. bool-table:: text_document.references.dynamic_registration diff --git a/docs/capabilities/text-document/rename.rst b/docs/capabilities/text-document/rename.rst index 18d2e84..160fb91 100644 --- a/docs/capabilities/text-document/rename.rst +++ b/docs/capabilities/text-document/rename.rst @@ -1,19 +1,18 @@ -``textDocument/rename`` -======================= +``rename`` +========== Capabilities relating to the :lsp:`textDocument/rename` request. -Dynamic Registration --------------------- +.. default-domain:: capabilities -.. capabilities:bool-table:: text_document.rename.dynamic_registration +.. bool-table:: text_document.rename.dynamic_registration -Prepare Support ---------------- +.. bool-table:: text_document.rename.prepare_support -.. capabilities:bool-table:: text_document.rename.prepare_support +.. bool-table:: text_document.rename.honors_change_annotations -Honors Change Annotations -------------------------- -.. capabilities:bool-table:: text_document.rename.honors_change_annotations +``prepareSupportDefaultBehavior`` +--------------------------------- + +.. values-table:: text_document.rename.prepare_support_default_behavior diff --git a/docs/capabilities/text-document/selection-range.rst b/docs/capabilities/text-document/selection-range.rst index d23007e..47f3aa1 100644 --- a/docs/capabilities/text-document/selection-range.rst +++ b/docs/capabilities/text-document/selection-range.rst @@ -1,9 +1,8 @@ -``textDocument/selectionRange`` -=============================== +``selectionRange`` +================== Capabilities relating to the :lsp:`textDocument/selectionRange` request. -Dynamic Registration --------------------- +.. default-domain:: capabilities -.. capabilities:bool-table:: text_document.selection_range.dynamic_registration +.. bool-table:: text_document.selection_range.dynamic_registration diff --git a/docs/capabilities/text-document/semantic-tokens.rst b/docs/capabilities/text-document/semantic-tokens.rst index b12778b..e3666e6 100644 --- a/docs/capabilities/text-document/semantic-tokens.rst +++ b/docs/capabilities/text-document/semantic-tokens.rst @@ -1,45 +1,28 @@ -``textDocument/semanticTokens`` -=============================== +``semanticTokens`` +================== Capabilities relating to :lsp:`textDocument/semanticTokens`. -Dynamic Registration --------------------- +.. default-domain:: capabilities -.. capabilities:bool-table:: text_document.semantic_tokens.dynamic_registration +.. bool-table:: text_document.semantic_tokens.dynamic_registration -``textDocument/semanticTokens/range`` -------------------------------------- +.. bool-table:: text_document.semantic_tokens.requests.range -.. capabilities:bool-table:: text_document.semantic_tokens.requests.range +.. bool-table:: text_document.semantic_tokens.requests.full -``textDocument/semanticTokens/full`` -------------------------------------- +.. bool-table:: text_document.semantic_tokens.requests.full.delta -.. capabilities:bool-table:: text_document.semantic_tokens.requests.full +.. values-table:: text_document.semantic_tokens.token_types + :value-set: SemanticTokenTypes -``textDocument/semanticTokens/full/delta`` ------------------------------------------- +.. values-table:: text_document.semantic_tokens.token_modifiers + :value-set: SemanticTokenModifiers -.. capabilities:bool-table:: text_document.semantic_tokens.requests.full.delta +.. bool-table:: text_document.semantic_tokens.overlapping_token_support +.. bool-table:: text_document.semantic_tokens.multiline_token_support -Overlapping Tokens ------------------- +.. bool-table:: text_document.semantic_tokens.server_cancel_support -.. capabilities:bool-table:: text_document.semantic_tokens.overlapping_token_support - -Multiline Tokens ----------------- - -.. capabilities:bool-table:: text_document.semantic_tokens.multiline_token_support - -Server Cancel Support ---------------------- - -.. capabilities:bool-table:: text_document.semantic_tokens.server_cancel_support - -Augments Syntax Tokens ----------------------- - -.. capabilities:bool-table:: text_document.semantic_tokens.augments_syntax_tokens +.. bool-table:: text_document.semantic_tokens.augments_syntax_tokens diff --git a/docs/capabilities/text-document/signature-help.rst b/docs/capabilities/text-document/signature-help.rst index e268549..cea6c52 100644 --- a/docs/capabilities/text-document/signature-help.rst +++ b/docs/capabilities/text-document/signature-help.rst @@ -1,24 +1,21 @@ -``textDocument/signatureHelp`` -============================== +``signatureHelp`` +================= Capabilities relating to the :lsp:`textDocument/signatureHelp` request. -Dynamic Registration --------------------- +.. default-domain:: capabilities -.. capabilities:bool-table:: text_document.signature_help.dynamic_registration +.. bool-table:: text_document.signature_help.dynamic_registration -Label Offset Support --------------------- +.. bool-table:: text_document.signature_help.context_support -.. capabilities:bool-table:: text_document.signature_help.signature_information.parameter_information.label_offset_support - -Active Parameter Support +``signatureInformation`` ------------------------ -.. capabilities:bool-table:: text_document.signature_help.signature_information.active_parameter_support +.. bool-table:: text_document.signature_help.signature_information.active_parameter_support + -Context Support ---------------- +``parameterInformation`` +^^^^^^^^^^^^^^^^^^^^^^^^ -.. capabilities:bool-table:: text_document.signature_help.context_support +.. bool-table:: text_document.signature_help.signature_information.parameter_information.label_offset_support diff --git a/docs/capabilities/text-document/synchronization.rst b/docs/capabilities/text-document/synchronization.rst new file mode 100644 index 0000000..1966acb --- /dev/null +++ b/docs/capabilities/text-document/synchronization.rst @@ -0,0 +1,12 @@ +``synchronization`` +=================== + +.. default-domain:: capabilities + +.. bool-table:: text_document.synchronization.dynamic_registration + +.. bool-table:: text_document.synchronization.did_save + +.. bool-table:: text_document.synchronization.will_save + +.. bool-table:: text_document.synchronization.will_save_wait_until diff --git a/docs/capabilities/text-document/type-definition.rst b/docs/capabilities/text-document/type-definition.rst index 3f0c9d7..1b913b9 100644 --- a/docs/capabilities/text-document/type-definition.rst +++ b/docs/capabilities/text-document/type-definition.rst @@ -1,14 +1,10 @@ -``textDocument/typeDefinition`` -=============================== +``typeDefinition`` +================== Capabilities relating to the :lsp:`textDocument/typeDefinition` request. -Dynamic Registration --------------------- +.. default-domain:: capabilities -.. capabilities:bool-table:: text_document.type_definition.dynamic_registration +.. bool-table:: text_document.type_definition.dynamic_registration -Link Support ------------- - -.. capabilities:bool-table:: text_document.type_definition.link_support +.. bool-table:: text_document.type_definition.link_support diff --git a/docs/capabilities/text-document/type-hierachy.rst b/docs/capabilities/text-document/type-hierachy.rst new file mode 100644 index 0000000..e4a6f29 --- /dev/null +++ b/docs/capabilities/text-document/type-hierachy.rst @@ -0,0 +1,8 @@ +``typeHierarchy`` +================= + +Capabilities relating to the :lsp:`textDocument/prepareTypeHierarchy` request. + +.. default-domain:: capabilities + +.. bool-table:: text_document.type_hierarchy.dynamic_registration diff --git a/docs/capabilities/window.rst b/docs/capabilities/window.rst index e5e6a0c..cc7bd14 100644 --- a/docs/capabilities/window.rst +++ b/docs/capabilities/window.rst @@ -1,5 +1,5 @@ -Window -====== +``window`` +========== .. toctree:: :maxdepth: 1 diff --git a/docs/capabilities/window/progress.rst b/docs/capabilities/window/progress.rst index f882024..bb8929d 100644 --- a/docs/capabilities/window/progress.rst +++ b/docs/capabilities/window/progress.rst @@ -1,4 +1,4 @@ -``window/workDoneProgress/create`` -================================== +``workDoneProgress`` +==================== .. capabilities:bool-table:: window.work_done_progress diff --git a/docs/capabilities/window/show-document.rst b/docs/capabilities/window/show-document.rst index 0749e7f..7f668c5 100644 --- a/docs/capabilities/window/show-document.rst +++ b/docs/capabilities/window/show-document.rst @@ -1,5 +1,5 @@ -``window/showDocument`` -======================= +``showDocument`` +================ Capabilities relating to the :lsp:`window/showDocument` request. diff --git a/docs/capabilities/window/show-message.rst b/docs/capabilities/window/show-message.rst index 41b01da..9c568eb 100644 --- a/docs/capabilities/window/show-message.rst +++ b/docs/capabilities/window/show-message.rst @@ -1,9 +1,11 @@ -``window/showMessageRequest`` -============================= +``showMessage`` +=============== Capabilities relating to the :lsp:`window/showMessageRequest` request. -Additional Properties Support ------------------------------ +.. default-domain:: capabilities -.. capabilities:bool-table:: window.show_message.message_action_item.additional_properties_support +``messageActionItem`` +--------------------- + +.. bool-table:: window.show_message.message_action_item.additional_properties_support diff --git a/docs/capabilities/workspace.rst b/docs/capabilities/workspace.rst index cd46a86..b2d0986 100644 --- a/docs/capabilities/workspace.rst +++ b/docs/capabilities/workspace.rst @@ -1,5 +1,5 @@ -Workspace -========= +``workspace`` +============= .. toctree:: :maxdepth: 1 diff --git a/docs/capabilities/workspace/apply-edit.rst b/docs/capabilities/workspace/apply-edit.rst index ffa5f13..472f538 100644 --- a/docs/capabilities/workspace/apply-edit.rst +++ b/docs/capabilities/workspace/apply-edit.rst @@ -1,6 +1,8 @@ -``workspace/applyEdit`` -======================= +``applyEdit`` +============= Capabilities relating to the :lsp:`workspace/applyEdit` request. -.. capabilities:bool-table:: workspace.apply_edit +.. default-domain:: capabilities + +.. bool-table:: workspace.apply_edit diff --git a/docs/capabilities/workspace/code-lens-refresh.rst b/docs/capabilities/workspace/code-lens.rst similarity index 59% rename from docs/capabilities/workspace/code-lens-refresh.rst rename to docs/capabilities/workspace/code-lens.rst index b4924ea..3535ae1 100644 --- a/docs/capabilities/workspace/code-lens-refresh.rst +++ b/docs/capabilities/workspace/code-lens.rst @@ -1,9 +1,6 @@ -``workspace/codeLens/refresh`` -============================== +``codeLens`` +============ Capabilities relating to the :lsp:`workspace/codeLens/refresh` request. -Refresh Support ---------------- - .. capabilities:bool-table:: workspace.code_lens.refresh_support diff --git a/docs/capabilities/workspace/configuration.rst b/docs/capabilities/workspace/configuration.rst index f867146..1f3819a 100644 --- a/docs/capabilities/workspace/configuration.rst +++ b/docs/capabilities/workspace/configuration.rst @@ -1,16 +1,8 @@ -``workspace/configuration`` -=========================== +``configuration`` +================= Capabilities relating to the :lsp:`workspace/configuration` request. -.. capabilities:bool-table:: workspace.configuration +.. default-domain:: capabilities -``workspace/didChangeConfiguration`` -==================================== - -Capabilities relating to the :lsp:`workspace/didChangeConfiguration` notification. - -Dynamic Registration --------------------- - -.. capabilities:bool-table:: workspace.did_change_configuration.dynamic_registration +.. bool-table:: workspace.configuration diff --git a/docs/capabilities/workspace/diagnostics.rst b/docs/capabilities/workspace/diagnostics.rst new file mode 100644 index 0000000..3d49698 --- /dev/null +++ b/docs/capabilities/workspace/diagnostics.rst @@ -0,0 +1,6 @@ +``diagnostics`` +=============== + +Capabilities relating to the :lsp:`workspace/diagnostic/refresh` request. + +.. capabilities:bool-table:: workspace.diagnostics.refresh_support diff --git a/docs/capabilities/workspace/did-change-configuration.rst b/docs/capabilities/workspace/did-change-configuration.rst new file mode 100644 index 0000000..8c3cb6d --- /dev/null +++ b/docs/capabilities/workspace/did-change-configuration.rst @@ -0,0 +1,8 @@ +``didChangeConfiguration`` +========================== + +Capabilities relating to the :lsp:`workspace/didChangeConfiguration` notification. + +.. default-domain:: capabilities + +.. bool-table:: workspace.did_change_configuration.dynamic_registration diff --git a/docs/capabilities/workspace/did-change-watched-files.rst b/docs/capabilities/workspace/did-change-watched-files.rst new file mode 100644 index 0000000..a304cfc --- /dev/null +++ b/docs/capabilities/workspace/did-change-watched-files.rst @@ -0,0 +1,8 @@ +``didChangeWatchedFiles`` +========================= + +.. default-domain:: capabilities + +.. bool-table:: workspace.did_change_watched_files.dynamic_registration + +.. bool-table:: workspace.did_change_watched_files.relative_pattern_support diff --git a/docs/capabilities/workspace/executeCommand.rst b/docs/capabilities/workspace/execute-command.rst similarity index 71% rename from docs/capabilities/workspace/executeCommand.rst rename to docs/capabilities/workspace/execute-command.rst index e11bf54..87562e6 100644 --- a/docs/capabilities/workspace/executeCommand.rst +++ b/docs/capabilities/workspace/execute-command.rst @@ -1,5 +1,5 @@ -``workspace/executeCommand`` -============================ +``executeCommand`` +================== Capabilities relating to the :lsp:`workspace/executeCommand` request. diff --git a/docs/capabilities/workspace/file-operations.rst b/docs/capabilities/workspace/file-operations.rst index 0ee78f7..f174282 100644 --- a/docs/capabilities/workspace/file-operations.rst +++ b/docs/capabilities/workspace/file-operations.rst @@ -1,56 +1,18 @@ -``workspace/willCreateFiles`` -============================= +``fileOperations`` +================== -Capabilities relating to the :lsp:`workspace/willCreateFiles` request. +.. default-domain:: capabilities -.. capabilities:bool-table:: workspace.file_operations.will_create +.. bool-table:: workspace.file_operations.dynamic_registration -``workspace/didCreateFiles`` -============================= +.. bool-table:: workspace.file_operations.will_create -Capabilities relating to the :lsp:`workspace/didCreateFiles` notification. +.. bool-table:: workspace.file_operations.did_create -.. capabilities:bool-table:: workspace.file_operations.did_create +.. bool-table:: workspace.file_operations.will_rename -``workspace/willRenameFiles`` -============================= +.. bool-table:: workspace.file_operations.did_rename -Capabilities relating to the :lsp:`workspace/willRenameFiles` request. +.. bool-table:: workspace.file_operations.will_delete -.. capabilities:bool-table:: workspace.file_operations.will_rename - -``workspace/didRenameFiles`` -============================= - -Capabilities relating to the :lsp:`workspace/didRenameFiles` notification. - -.. capabilities:bool-table:: workspace.file_operations.did_rename - -``workspace/willDeleteFiles`` -============================= - -Capabilities relating to the :lsp:`workspace/willDeleteFiles` request. - -.. capabilities:bool-table:: workspace.file_operations.will_delete - -``workspace/didDeleteFiles`` -============================= - -Capabilities relating to the :lsp:`workspace/didDeleteFiles` notification. - -.. capabilities:bool-table:: workspace.file_operations.did_delete - -``workspace/didChangeWatchedFiles`` -=================================== - -Capabilities relating to the :lsp:`workspace/didChangeWatchedFiles` notification. - -Dynamic Registration --------------------- - -.. capabilities:bool-table:: workspace.did_change_watched_files.dynamic_registration - -Relative Pattern Support ------------------------- - -.. capabilities:bool-table:: workspace.did_change_watched_files.relative_pattern_support +.. bool-table:: workspace.file_operations.did_delete diff --git a/docs/capabilities/workspace/inlay-hint-refresh.rst b/docs/capabilities/workspace/inlay-hint.rst similarity index 59% rename from docs/capabilities/workspace/inlay-hint-refresh.rst rename to docs/capabilities/workspace/inlay-hint.rst index 6233876..b5d1518 100644 --- a/docs/capabilities/workspace/inlay-hint-refresh.rst +++ b/docs/capabilities/workspace/inlay-hint.rst @@ -1,9 +1,6 @@ -``workspace/inlayHint/refresh`` -=============================== +``inlayHint`` +============= Capabilities relating to the :lsp:`workspace/inlayHint/refresh` request. -Refresh Support ---------------- - .. capabilities:bool-table:: workspace.inlay_hint.refresh_support diff --git a/docs/capabilities/workspace/inline-value-refresh.rst b/docs/capabilities/workspace/inline-value.rst similarity index 58% rename from docs/capabilities/workspace/inline-value-refresh.rst rename to docs/capabilities/workspace/inline-value.rst index 6035a7b..af67801 100644 --- a/docs/capabilities/workspace/inline-value-refresh.rst +++ b/docs/capabilities/workspace/inline-value.rst @@ -1,9 +1,6 @@ -``workspace/inlineValue/refresh`` -================================= +``inlineValue`` +=============== Capabilities relating to the :lsp:`workspace/inlineValue/refresh` request. -Rehresh Support ---------------- - .. capabilities:bool-table:: workspace.inline_value.refresh_support diff --git a/docs/capabilities/workspace/semantic-tokens.rst b/docs/capabilities/workspace/semantic-tokens.rst new file mode 100644 index 0000000..59aa098 --- /dev/null +++ b/docs/capabilities/workspace/semantic-tokens.rst @@ -0,0 +1,6 @@ +``semanticTokens`` +================== + +Capabilities relating to the :lsp:`workspace/semanticTokens/refresh` request. + +.. capabilities:bool-table:: workspace.semantic_tokens.refresh_support diff --git a/docs/capabilities/workspace/symbol.rst b/docs/capabilities/workspace/symbol.rst index 607cd0a..d691ce8 100644 --- a/docs/capabilities/workspace/symbol.rst +++ b/docs/capabilities/workspace/symbol.rst @@ -1,9 +1,25 @@ -``workspace/symbol`` -==================== +``symbol`` +========== Capabilities relating to the :lsp:`workspace/symbol` request. -Dynamic Registration --------------------- +.. default-domain:: capabilities -.. capabilities:bool-table:: workspace.symbol.dynamic_registration +.. bool-table:: workspace.symbol.dynamic_registration + +``symbolKind`` +-------------- + +.. values-table:: workspace.symbol.symbol_kind.value_set + :value-set: SymbolKind + +``tagSupport`` +-------------- + +.. values-table:: workspace.symbol.tag_support.value_set + :value-set: SymbolTag + +``resolveSupport`` +------------------ + +.. values-table:: workspace.symbol.resolve_support.properties diff --git a/docs/capabilities/workspace/workspace-edit.rst b/docs/capabilities/workspace/workspace-edit.rst new file mode 100644 index 0000000..5eb65de --- /dev/null +++ b/docs/capabilities/workspace/workspace-edit.rst @@ -0,0 +1,18 @@ +``workspaceEdit`` +================= + +.. default-domain:: capabilities + +.. bool-table:: workspace.workspace_edit.document_changes + +.. values-table:: workspace.workspace_edit.resource_operations + :value-set: ResourceOperationKind + +.. values-table:: workspace.workspace_edit.failure_handling + +.. bool-table:: workspace.workspace_edit.normalizes_line_endings + +``changeAnnotationSupport`` +--------------------------- + +.. bool-table:: workspace.workspace_edit.change_annotation_support.groups_on_label diff --git a/docs/capabilities/workspace/workspace-folders.rst b/docs/capabilities/workspace/workspace-folders.rst index 82dffdc..2765374 100644 --- a/docs/capabilities/workspace/workspace-folders.rst +++ b/docs/capabilities/workspace/workspace-folders.rst @@ -1,5 +1,5 @@ -``workspace/workspaceFolders`` -============================== +``workspaceFolders`` +==================== Capabilities relating to the :lsp:`workspace/workspaceFolders` request. diff --git a/docs/ext/capabilities.py b/docs/ext/capabilities.py index 74f4885..88c239d 100644 --- a/docs/ext/capabilities.py +++ b/docs/ext/capabilities.py @@ -1,34 +1,95 @@ +import enum import importlib.resources as resources import json +import operator import pathlib import re import typing from typing import Dict from typing import List from typing import Optional +from typing import Tuple import attrs from docutils import nodes from docutils.parsers.rst import directives +from docutils.statemachine import StringList from lsprotocol import types from lsprotocol.converters import get_converter from packaging.version import parse as parse_version from pygls.capabilities import get_capability +from sphinx import addnodes from sphinx.application import Sphinx +from sphinx.directives import ObjectDescription from sphinx.domains import Domain from sphinx.pycode import ModuleAnalyzer from sphinx.util.docutils import SphinxDirective -class BoolTable(SphinxDirective): - """Given a boolean capability, indicate the support across known clients and - versions""" +class CapabilityTable(ObjectDescription[str]): + """Base directive for generating tables describing support for LSP capabilities.""" - required_arguments = 1 + def handle_signature(self, sig: str, signode: addnodes.desc_signature) -> str: + """Render the name of the capability.""" + try: + name = to_camel_case(sig) + parts = name.split(".") + parent_name = ".".join(parts[:-1]) + "." + + domain = self.env.domains[self.domain] + documentation, lsp_version = domain.get_capability_documentation(sig) + + # Save the documentation from the spec until we can insert it into the page + self.env.temp_data["extra-capability-documentation"] = documentation + + if lsp_version: + signode += addnodes.desc_annotation( + lsp_version, + "", + addnodes.desc_sig_literal_string("", f"since v{lsp_version}"), + addnodes.desc_sig_space(), + ) + + signode["ids"].append(name) + signode["python-name"] = sig + signode["spec-name"] = name + signode += addnodes.desc_addname(parent_name, parent_name) + signode += addnodes.desc_name("", parts[-1]) + + return name + except Exception as exc: + breakpoint() + return ... + + def _object_hierarchy_parts( + self, signode: addnodes.desc_signature + ) -> Tuple[str, ...]: + """Return the full hierarchy of the capability, used for toctree generation.""" + name = signode["spec-name"] + return tuple(name.split(".")[:-1]) + + def _toc_entry_name(self, signode: addnodes.desc_signature) -> str: + """Return the name of capability, used for toctree generation.""" + name = signode["spec-name"] + return name.split(".")[-1] + + def render_table(self, contentnode: addnodes.desc_content): + """Render the table to insert into the page.""" + return [] + + def transform_content(self, contentnode: addnodes.desc_content): + """Insert documentation about the capability.""" + + contentnode += self.render_table(contentnode) + + documentation = self.env.temp_data["extra-capability-documentation"] + if len(documentation) > 0: + self.state.nested_parse(StringList(documentation), 0, contentnode) - option_spec = { - "caption": directives.unchanged, - } + +class BoolCapabilityTable(CapabilityTable): + """Given a boolean capability, indicate the support across known clients and + versions""" def build_header(self): columns = ["Client", "Supported Since"] @@ -65,7 +126,7 @@ def build_body(self, capability: str): rows = [] clients = self.get_client_support_for(capability) - for name, version in clients.items(): + for name, version in sorted(clients.items(), key=operator.itemgetter(0)): rows.append( nodes.row( "", @@ -80,28 +141,133 @@ def build_body(self, capability: str): return nodes.tbody("", *rows) - def run(self): - domain = self.env.domains["capabilities"] - - capability = self.arguments[0] - if len(documentation := domain.get_capability_documentation(capability)) > 0: - self.state_machine.insert_input(documentation, "") + def render_table(self, contentnode: addnodes.desc_content): + capability = contentnode.parent[0]["python-name"] header, colspecs = self.build_header() body = self.build_body(capability) table = nodes.table("", nodes.tgroup("", *colspecs, header, body)) - if (caption := self.options.get("caption", None)) is not None: - table.insert(0, nodes.title("", caption)) + return [table] + + +class ValueSetCapabilityTable(CapabilityTable): + """Given a capability that enumerates a set of values, indicate their support across + known clients and versions.""" + + option_spec = { + "value-set": directives.unchanged, + **CapabilityTable.option_spec, + } + + def get_known_values(self, capability: str): + values = set() + domain = self.env.domains["capabilities"] - paragraph = nodes.paragraph( + for capabilities in domain.clients.values(): + client_values = get_capability(capabilities, capability, []) + if not isinstance(client_values, list): + client_values = [client_values] + + for value in client_values: + if isinstance(value, enum.Enum): + if isinstance(value, int): + values.add(value.name) + else: + values.add(value.value) + else: + values.add(value) + + return sorted(list(values)) + + def get_values(self, capability: str): + if (value_set := self.options.get("value-set", None)) is None: + # No pre-defined list, return a list of all values we see in our client + # capabilities + return self.get_known_values(capability) + + # TODO: Handle int enums... + value_set_type = getattr(types, value_set) + if issubclass(value_set_type, int): + return sorted([v.name for v in list(value_set_type)]) + else: + return sorted([v.value for v in list(value_set_type)]) + + def build_header(self, capability: str): + values = self.get_values(capability) + + colspecs = [nodes.colspec("", colwidth="4")] + [ + nodes.colspec("", colwidth="1") for _ in range(len(values)) + ] + header = nodes.thead( "", - nodes.Text("Capability: "), - nodes.literal("", to_camel_case(capability)), + nodes.row( + "", + nodes.entry("", nodes.Text("Client")), + *[nodes.entry("", nodes.literal(value, value)) for value in values], + ), ) - return [table, paragraph] + return header, colspecs + + def get_client_support_for(self, capability: str): + domain = self.env.domains["capabilities"] + values = self.get_values(capability) + + clients = {} + for (name, version), capabilities in domain.clients.items(): + if name not in clients: + clients[name] = {v: None for v in values} + + supported_values = get_capability(capabilities, capability, None) + if supported_values is None: + continue + + if not isinstance(supported_values, list): + supported_values = [supported_values] + + supported_values = set(supported_values) + for value in clients[name]: + if (existing := clients[name][value]) is None: + clients[name][value] = version + else: + clients[name][value] = min(existing, version, key=parse_version) + + client_support = { + name: [(v, value[v]) for v in values] for name, value in clients.items() + } + + return client_support + + def build_body(self, capability: str): + rows = [] + clients = self.get_client_support_for(capability) + + for name, support in sorted(clients.items(), key=operator.itemgetter(0)): + cells = [] + + for _, supported_version in support: + cells.append( + nodes.entry( + "", + nodes.Text(supported_version or " - "), + classes=["centered"], + ), + ) + + rows.append(nodes.row("", nodes.entry("", nodes.Text(name)), *cells)) + + return nodes.tbody("", *rows) + + def render_table(self, contentnode: addnodes.desc_content): + capability = contentnode.parent[0]["python-name"] + + header, colspecs = self.build_header(capability) + body = self.build_body(capability) + + table = nodes.table("", nodes.tgroup("", *colspecs, header, body)) + return table def to_camel_case(snake_text: str) -> str: @@ -137,27 +303,33 @@ def _load_clients(): SINCE_PATTERN = re.compile(r"@since ([\d\.]+)") -def process_docstring(lines): +def process_docstring(lines: List[str]) -> Optional[str]: """Fixup LSP docstrings so that they work with reStructuredText syntax - - Replaces ``@since `` with ``**LSP v**`` + This modifies the give ``lines`` in-place to: - - Replaces ``{@link }`` with ``:class:`~lsprotocol.types.` `` + - Replace ``{@link }`` with ``:class:`~lsprotocol.types.` `` - - Replaces markdown hyperlink with reStructuredText equivalent + - Replace markdown hyperlink with reStructuredText equivalent - - Replaces inline markdown code (single "`") with reStructuredText inline code + - Replace inline markdown code (single "`") with reStructuredText inline code (double "`") - - Inserts the required newline before a bulleted list + - Insert the required newline before a bulleted list + + - Replace code fences with code blocks - - Replaces code fences with code blocks + - Fixe indentation - - Fixes indentation + Returns + ------- + str + If ``@since `` was found, the version string will be returned. """ line_breaks = [] code_fences = [] + lsp_version: Optional[str] = None for i, line in enumerate(lines): if line.startswith("- "): @@ -172,7 +344,10 @@ def process_docstring(lines): if (match := SINCE_PATTERN.search(line)) is not None: start, end = match.span() - lines[i] = "".join([line[:start], f"**LSP v{match.group(1)}**", line[end:]]) + lsp_version = match.group(1) + + # Remove the @since declaration from the given set of lines. + lines[i] = "".join([line[:start], line[end:]]) if (match := LINK_PATTERN.search(line)) is not None: start, end = match.span() @@ -221,12 +396,15 @@ def process_docstring(lines): for offset, line in enumerate(line_breaks): lines.insert(line + offset, "") + return lsp_version + class CapabilitiesDomain(Domain): name = "capabilities" directives = { - "bool-table": BoolTable, + "bool-table": BoolCapabilityTable, + "values-table": ValueSetCapabilityTable, } def __init__(self, *args, **kwargs): @@ -236,7 +414,9 @@ def __init__(self, *args, **kwargs): self.analyzer = ModuleAnalyzer.for_module("lsprotocol.types") self.analyzer.analyze() - def get_capability_documentation(self, field_name: str) -> List[str]: + def get_capability_documentation( + self, field_name: str + ) -> Tuple[List[str], Optional[str]]: """Return the documentation associated with the given capability.""" type_ = types.ClientCapabilities parent = type_.__name__ @@ -252,9 +432,9 @@ def get_capability_documentation(self, field_name: str) -> List[str]: parent = type_.__name__ lines = self.analyzer.attr_docs.get((parent, field), []) - process_docstring(lines) + lsp_version = process_docstring(lines) - return lines + return lines, lsp_version def setup(app: Sphinx): diff --git a/docs/index.rst b/docs/index.rst index 2e7c601..05d20da 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -7,10 +7,6 @@ process of developing language servers easier. Client Capability Index ----------------------- -.. warning:: - - This is still under construction. - .. important:: This accuracy of this section entirely depends on the captured capabilities data that is `bundled `__ with pytest-lsp. @@ -18,21 +14,33 @@ Client Capability Index Pull requests for corrections and new data welcome! .. toctree:: - :maxdepth: 2 + :glob: :hidden: :caption: Client Capabilities - capabilities/text-document - capabilities/workspace - capabilities/window + capabilities/* Inspired by `caniuse.com `__ this provides information on which clients support which features of the `LSP Specification `__. .. grid:: 2 :gutter: 2 - .. grid-item-card:: Text Document + .. grid-item-card:: General :columns: 12 + :link: /capabilities/general + :link-type: doc + :text-align: center + + General client capabilities. + + .. grid-item-card:: NotebookDocument + :link: /capabilities/notebook-document + :link-type: doc + :text-align: center + + Capabilities for NotebookDocuments. + + .. grid-item-card:: TextDocument :link: /capabilities/text-document :link-type: doc :text-align: center diff --git a/docs/lsp-devtools/guide/record-command.rst b/docs/lsp-devtools/guide/record-command.rst index 0465cac..ed8c09f 100644 --- a/docs/lsp-devtools/guide/record-command.rst +++ b/docs/lsp-devtools/guide/record-command.rst @@ -81,7 +81,7 @@ As well as printing to console, the record command supports a number of other ou lsp-devtools record --to-sqlite example.db - This database can then be opened in other tools like `datasette `_, `SQLite Browser `_ or even ``lsp-devtools`` own :doc:`/lsp-devtools/guide/tui-command`. + This database can then be opened in other tools like `datasette `_, `SQLite Browser `_ or even ``lsp-devtools`` own :doc:`/lsp-devtools/guide/inspect-command`. .. dropdown:: DB Schema diff --git a/docs/pytest-lsp/guide/troubleshooting.rst b/docs/pytest-lsp/guide/troubleshooting.rst index e550e33..dd13066 100644 --- a/docs/pytest-lsp/guide/troubleshooting.rst +++ b/docs/pytest-lsp/guide/troubleshooting.rst @@ -49,34 +49,27 @@ Alternatively, if you prefer, you can set the following configuration option in In which case `pytest-asyncio`_ will automatically collect and run any ``async`` test function in your test suite. -``ScopeMismatch`` Error ------------------------ - -Setting your client `fixture's scope `__ to something like ``session`` will allow you to reuse the same client-server connection across multiple test cases. -However, you're likely to encounter an error like the following:: +.. _pytest-asyncio: https://github.com/pytest-dev/pytest-asyncio - __________________________ ERROR at setup of test_capabilities _________________________ - ScopeMismatch: You tried to access the function scoped fixture event_loop with a session - scoped request object, involved factories: - /.../site-packages/pytest_lsp/plugin.py:201: def the_fixture(request) +My tests hang! +-------------- +If you find that your test suite hangs with no obvious cause or errors, make sure that all of your test functions are tagged with the appropriate ``scope``. -This is due to the default `event_loop `__ fixture provided by `pytest-asyncio`_ not living long enough to support your client. -To fix this you can override the ``event_loop`` fixture, setting its scope to match that of your client. +For exmaple, if you define your client fixture with ``scope="module"`` -.. code-block:: python +.. literalinclude:: ../../../lib/pytest-lsp/tests/examples/fixture-scope/t_server.py + :language: python + :start-at: @pytest_lsp.fixture + :end-at: async def - @pytest.fixture(scope="session") - def event_loop(): - """Redefine `pytest-asyncio's default event_loop fixture to match the scope - of our client fixture.""" - policy = asyncio.get_event_loop_policy() - loop = policy.new_event_loop() - yield loop - loop.close() +Then all test cases that make use of the fixture must also be tagged with the same scope. +.. literalinclude:: ../../../lib/pytest-lsp/tests/examples/fixture-scope/t_server.py + :language: python + :start-at: @pytest.mark.asyncio + :end-at: async def -.. _pytest-asyncio: https://github.com/pytest-dev/pytest-asyncio ``DeprecationWarning``: Unclosed event loop ------------------------------------------- @@ -110,3 +103,33 @@ Depending on the version of ``pygls`` (the LSP implementation used by ``pytest-l =========================== 1 passed, 1 warning in 0.64s ============================= This is a known issue in ``pygls v1.0.2`` and older, upgrading your ``pygls`` version to ``1.1.0`` or newer should resolve the issue. + +``ScopeMismatch`` Error +----------------------- + +.. important:: + + This only applies to versions of ``pytest-asyncio`` prior to ``v0.23.0`` + +Setting your client `fixture's scope `__ to something like ``session`` will allow you to reuse the same client-server connection across multiple test cases. +However, you're likely to encounter an error like the following:: + + __________________________ ERROR at setup of test_capabilities _________________________ + ScopeMismatch: You tried to access the function scoped fixture event_loop with a session + scoped request object, involved factories: + /.../site-packages/pytest_lsp/plugin.py:201: def the_fixture(request) + + +This is due to the default ``event_loop`` fixture provided by `pytest-asyncio`_ not living long enough to support your client. +To fix this you can override the ``event_loop`` fixture, setting its scope to match that of your client. + +.. code-block:: python + + @pytest.fixture(scope="session") + def event_loop(): + """Redefine `pytest-asyncio's default event_loop fixture to match the scope + of our client fixture.""" + policy = asyncio.get_event_loop_policy() + loop = policy.new_event_loop() + yield loop + loop.close() diff --git a/lib/lsp-devtools/pyproject.toml b/lib/lsp-devtools/pyproject.toml index 32d4998..c35aa5a 100644 --- a/lib/lsp-devtools/pyproject.toml +++ b/lib/lsp-devtools/pyproject.toml @@ -34,7 +34,7 @@ dependencies = [ [project.urls] "Bug Tracker" = "https://github.com/swyddfa/lsp-devtools/issues" -"Documentation" = "https://swyddfa.github.io/lsp-devtools/" +"Documentation" = "https://lsp-devtools.readthedocs.io/en/latest/" "Source Code" = "https://github.com/swyddfa/lsp-devtools" [project.scripts] diff --git a/lib/lsp-devtools/tests/servers/simple.py b/lib/lsp-devtools/tests/servers/simple.py index 2bb2816..6bda60d 100644 --- a/lib/lsp-devtools/tests/servers/simple.py +++ b/lib/lsp-devtools/tests/servers/simple.py @@ -1,4 +1,5 @@ """A very simple language server.""" + from lsprotocol import types from pygls.server import LanguageServer diff --git a/lib/pytest-lsp/changes/126.misc.md b/lib/pytest-lsp/changes/126.misc.md new file mode 100644 index 0000000..ebf9e33 --- /dev/null +++ b/lib/pytest-lsp/changes/126.misc.md @@ -0,0 +1 @@ +Bump minimum version of `pytest-asyncio` to `0.23.0` diff --git a/lib/pytest-lsp/changes/142.capability.md b/lib/pytest-lsp/changes/142.capability.md new file mode 100644 index 0000000..2271928 --- /dev/null +++ b/lib/pytest-lsp/changes/142.capability.md @@ -0,0 +1 @@ +Add client capabilities for Emacs v29.1 diff --git a/lib/pytest-lsp/changes/143.enhancement.md b/lib/pytest-lsp/changes/143.enhancement.md new file mode 100644 index 0000000..4795a08 --- /dev/null +++ b/lib/pytest-lsp/changes/143.enhancement.md @@ -0,0 +1 @@ +When a test fails `pytest-lsp` will now show the server's `stderr` output (if any) diff --git a/lib/pytest-lsp/pyproject.toml b/lib/pytest-lsp/pyproject.toml index 9313f68..d64fb15 100644 --- a/lib/pytest-lsp/pyproject.toml +++ b/lib/pytest-lsp/pyproject.toml @@ -28,12 +28,12 @@ dependencies = [ "packaging", "pygls>=1.1.0", "pytest", - "pytest-asyncio", + "pytest-asyncio>=0.23", ] [project.urls] "Bug Tracker" = "https://github.com/swyddfa/lsp-devtools/issues" -"Documentation" = "https://swyddfa.github.io/lsp-devtools/" +"Documentation" = "https://lsp-devtools.readthedocs.io/en/latest/" "Source Code" = "https://github.com/swyddfa/lsp-devtools" [project.entry-points.pytest11] diff --git a/lib/pytest-lsp/pytest_lsp/checks.py b/lib/pytest-lsp/pytest_lsp/checks.py index 8ff291e..385e05c 100644 --- a/lib/pytest-lsp/pytest_lsp/checks.py +++ b/lib/pytest-lsp/pytest_lsp/checks.py @@ -8,6 +8,7 @@ details. """ + import logging import warnings from typing import Any diff --git a/lib/pytest-lsp/pytest_lsp/client.py b/lib/pytest-lsp/pytest_lsp/client.py index d32d643..f93b3e3 100644 --- a/lib/pytest-lsp/pytest_lsp/client.py +++ b/lib/pytest-lsp/pytest_lsp/client.py @@ -61,9 +61,9 @@ def __init__(self, *args, configuration: Optional[Dict[str, Any]] = None, **kwar self.diagnostics: Dict[str, List[types.Diagnostic]] = {} """Holds any recieved diagnostics.""" - self.progress_reports: Dict[ - types.ProgressToken, List[types.ProgressParams] - ] = {} + self.progress_reports: Dict[types.ProgressToken, List[types.ProgressParams]] = ( + {} + ) """Holds any received progress updates.""" self.error: Optional[Exception] = None @@ -82,6 +82,22 @@ def __init__(self, *args, configuration: Optional[Dict[str, Any]] = None, **kwar self._last_log_index = 0 """Used to keep track of which log messages correspond with which test case.""" + self._stderr_forwarder: Optional[asyncio.Task] = None + """A task that forwards the server's stderr to the test process.""" + + async def start_io(self, cmd: str, *args, **kwargs): + await super().start_io(cmd, *args, **kwargs) + + # Forward the server's stderr to this process' stderr + if self._server and self._server.stderr: + self._stderr_forwarder = asyncio.create_task(forward_stderr(self._server)) + + async def stop(self): + if self._stderr_forwarder: + self._stderr_forwarder.cancel() + + return await super().stop() + async def server_exit(self, server: asyncio.subprocess.Process): """Called when the server process exits.""" logger.debug("Server process exited with code: %s", server.returncode) @@ -89,15 +105,10 @@ async def server_exit(self, server: asyncio.subprocess.Process): if self._stop_event.is_set(): return - stderr = "" - if server.stderr is not None: - stderr_bytes = await server.stderr.read() - stderr = stderr_bytes.decode("utf8") - loop = asyncio.get_running_loop() loop.call_soon( cancel_all_tasks, - f"Server process exited with return code: {server.returncode}\n{stderr}", + f"Server process exited with return code: {server.returncode}", ) def report_server_error( @@ -259,6 +270,15 @@ async def wait_for_notification(self, method: str): return await self.protocol.wait_for_notification_async(method) +async def forward_stderr(server: asyncio.subprocess.Process): + if server.stderr is None: + return + + # EOF is signalled with an empty bytestring + while (line := await server.stderr.readline()) != b"": + sys.stderr.buffer.write(line) + + def cancel_all_tasks(message: str): """Called to cancel all awaited tasks.""" diff --git a/lib/pytest-lsp/pytest_lsp/clients/emacs_v29.1.json b/lib/pytest-lsp/pytest_lsp/clients/emacs_v29.1.json new file mode 100644 index 0000000..4b14897 --- /dev/null +++ b/lib/pytest-lsp/pytest_lsp/clients/emacs_v29.1.json @@ -0,0 +1,175 @@ +{ + "clientInfo": { + "name": "Emacs (eglot)", + "version": "29.1" + }, + "capabilities": { + "workspace": { + "applyEdit": true, + "executeCommand": { + "dynamicRegistration": false + }, + "workspaceEdit": { + "documentChanges": true + }, + "didChangeWatchedFiles": { + "dynamicRegistration": true + }, + "symbol": { + "dynamicRegistration": false + }, + "configuration": true, + "workspaceFolders": true + }, + "textDocument": { + "synchronization": { + "dynamicRegistration": false, + "willSave": true, + "willSaveWaitUntil": true, + "didSave": true + }, + "completion": { + "dynamicRegistration": false, + "completionItem": { + "snippetSupport": false, + "deprecatedSupport": true, + "resolveSupport": { + "properties": [ + "documentation", + "details", + "additionalTextEdits" + ] + }, + "tagSupport": { + "valueSet": [ + 1 + ] + } + }, + "contextSupport": true + }, + "hover": { + "dynamicRegistration": false, + "contentFormat": [ + "markdown", + "plaintext" + ] + }, + "signatureHelp": { + "dynamicRegistration": false, + "signatureInformation": { + "parameterInformation": { + "labelOffsetSupport": true + }, + "activeParameterSupport": true + } + }, + "references": { + "dynamicRegistration": false + }, + "definition": { + "dynamicRegistration": false, + "linkSupport": true + }, + "declaration": { + "dynamicRegistration": false, + "linkSupport": true + }, + "implementation": { + "dynamicRegistration": false, + "linkSupport": true + }, + "typeDefinition": { + "dynamicRegistration": false, + "linkSupport": true + }, + "documentSymbol": { + "dynamicRegistration": false, + "hierarchicalDocumentSymbolSupport": true, + "symbolKind": { + "valueSet": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26 + ] + } + }, + "documentHighlight": { + "dynamicRegistration": false + }, + "codeAction": { + "dynamicRegistration": false, + "codeActionLiteralSupport": { + "codeActionKind": { + "valueSet": [ + "quickfix", + "refactor", + "refactor.extract", + "refactor.inline", + "refactor.rewrite", + "source", + "source.organizeImports" + ] + } + }, + "isPreferredSupport": true + }, + "formatting": { + "dynamicRegistration": false + }, + "rangeFormatting": { + "dynamicRegistration": false + }, + "rename": { + "dynamicRegistration": false + }, + "inlayHint": { + "dynamicRegistration": false + }, + "publishDiagnostics": { + "relatedInformation": false, + "codeDescriptionSupport": false, + "tagSupport": { + "valueSet": [ + 1, + 2 + ] + } + } + }, + "window": { + "workDoneProgress": true + }, + "general": { + "positionEncodings": [ + "utf-32", + "utf-8", + "utf-16" + ] + }, + "experimental": {} + } +} \ No newline at end of file diff --git a/lib/pytest-lsp/tests/examples/fixture-scope/server.py b/lib/pytest-lsp/tests/examples/fixture-scope/server.py new file mode 100644 index 0000000..2a54853 --- /dev/null +++ b/lib/pytest-lsp/tests/examples/fixture-scope/server.py @@ -0,0 +1,18 @@ +from lsprotocol.types import TEXT_DOCUMENT_COMPLETION +from lsprotocol.types import CompletionItem +from lsprotocol.types import CompletionParams +from pygls.server import LanguageServer + +server = LanguageServer("hello-world", "v1") + + +@server.feature(TEXT_DOCUMENT_COMPLETION) +def completion(ls: LanguageServer, params: CompletionParams): + return [ + CompletionItem(label="hello"), + CompletionItem(label="world"), + ] + + +if __name__ == "__main__": + server.start_io() diff --git a/lib/pytest-lsp/tests/examples/fixture-scope/t_server.py b/lib/pytest-lsp/tests/examples/fixture-scope/t_server.py new file mode 100644 index 0000000..a2f12f3 --- /dev/null +++ b/lib/pytest-lsp/tests/examples/fixture-scope/t_server.py @@ -0,0 +1,65 @@ +import sys + +import pytest +from lsprotocol import types + +import pytest_lsp +from pytest_lsp import ClientServerConfig +from pytest_lsp import LanguageClient + + +@pytest_lsp.fixture( + scope="module", + config=ClientServerConfig(server_command=[sys.executable, "server.py"]), +) +async def client(lsp_client: LanguageClient): + # Setup + params = types.InitializeParams(capabilities=types.ClientCapabilities()) + await lsp_client.initialize_session(params) + + yield + + # Teardown + await lsp_client.shutdown_session() + + +@pytest.mark.asyncio(scope="module") +async def test_completion_hello(client: LanguageClient): + """Ensure that the server implements completions correctly.""" + + results = await client.text_document_completion_async( + params=types.CompletionParams( + position=types.Position(line=1, character=0), + text_document=types.TextDocumentIdentifier(uri="file:///path/to/file.txt"), + ) + ) + assert results is not None + + if isinstance(results, types.CompletionList): + items = results.items + else: + items = results + + labels = {item.label for item in items} + assert "hello" in labels + + +@pytest.mark.asyncio(scope="module") +async def test_completion_world(client: LanguageClient): + """Ensure that the server implements completions correctly.""" + + results = await client.text_document_completion_async( + params=types.CompletionParams( + position=types.Position(line=1, character=0), + text_document=types.TextDocumentIdentifier(uri="file:///path/to/file.txt"), + ) + ) + assert results is not None + + if isinstance(results, types.CompletionList): + items = results.items + else: + items = results + + labels = {item.label for item in items} + assert "world" in labels diff --git a/lib/pytest-lsp/tests/examples/server-stderr/server.py b/lib/pytest-lsp/tests/examples/server-stderr/server.py new file mode 100644 index 0000000..c4886e5 --- /dev/null +++ b/lib/pytest-lsp/tests/examples/server-stderr/server.py @@ -0,0 +1,21 @@ +import sys + +from lsprotocol import types +from pygls.server import LanguageServer + +server = LanguageServer("server-stderr", "v1") + + +@server.feature(types.TEXT_DOCUMENT_COMPLETION) +def completion(params: types.CompletionParams): + items = [] + + for i in range(10): + print(f"Suggesting item {i}", file=sys.stderr, flush=True) + items.append(types.CompletionItem(label=f"item-{i}")) + + return items + + +if __name__ == "__main__": + server.start_io() diff --git a/lib/pytest-lsp/tests/examples/server-stderr/t_server.py b/lib/pytest-lsp/tests/examples/server-stderr/t_server.py new file mode 100644 index 0000000..239d50c --- /dev/null +++ b/lib/pytest-lsp/tests/examples/server-stderr/t_server.py @@ -0,0 +1,46 @@ +import sys + +from lsprotocol.types import ClientCapabilities +from lsprotocol.types import CompletionList +from lsprotocol.types import CompletionParams +from lsprotocol.types import InitializeParams +from lsprotocol.types import Position +from lsprotocol.types import TextDocumentIdentifier + +import pytest_lsp +from pytest_lsp import ClientServerConfig +from pytest_lsp import LanguageClient + + +@pytest_lsp.fixture( + config=ClientServerConfig(server_command=[sys.executable, "server.py"]), +) +async def client(lsp_client: LanguageClient): + # Setup + params = InitializeParams(capabilities=ClientCapabilities()) + await lsp_client.initialize_session(params) + + yield + + # Teardown + await lsp_client.shutdown_session() + + +async def test_completions(client: LanguageClient): + results = await client.text_document_completion_async( + params=CompletionParams( + position=Position(line=1, character=0), + text_document=TextDocumentIdentifier(uri="file:///path/to/file.txt"), + ) + ) + + assert results is not None + + if isinstance(results, CompletionList): + items = results.items + else: + items = results + + labels = [item.label for item in items] + assert labels == [f"item-{i}" for i in range(10)] + assert False # Force the test case to fail. diff --git a/lib/pytest-lsp/tests/test_examples.py b/lib/pytest-lsp/tests/test_examples.py index 956d4d2..e9a0399 100644 --- a/lib/pytest-lsp/tests/test_examples.py +++ b/lib/pytest-lsp/tests/test_examples.py @@ -28,6 +28,7 @@ def setup_test(pytester: pytest.Pytester, example_name: str): pytest.param("diagnostics", dict(passed=1), id="diagnostics"), pytest.param("getting-started", dict(passed=1), id="getting-started"), pytest.param("fixture-passthrough", dict(passed=1), id="fixture-passthrough"), + pytest.param("fixture-scope", dict(passed=2), id="fixture-scope"), pytest.param( "parameterised-clients", dict(passed=2), id="parameterised-clients" ), @@ -121,6 +122,27 @@ def test_generic_rpc(pytester: pytest.Pytester): results.stdout.fnmatch_lines(" *LOG: b=2") +def test_server_stderr_fail(pytester: pytest.Pytester): + """Ensure that the server's stderr stream is presented on failure.""" + + setup_test(pytester, "server-stderr") + + results = pytester.runpytest() + results.assert_outcomes(failed=1) + + results.stdout.fnmatch_lines("-* Captured stderr call -*") + results.stdout.fnmatch_lines("Suggesting item 0") + results.stdout.fnmatch_lines("Suggesting item 1") + results.stdout.fnmatch_lines("Suggesting item 2") + results.stdout.fnmatch_lines("Suggesting item 3") + results.stdout.fnmatch_lines("Suggesting item 4") + results.stdout.fnmatch_lines("Suggesting item 5") + results.stdout.fnmatch_lines("Suggesting item 6") + results.stdout.fnmatch_lines("Suggesting item 7") + results.stdout.fnmatch_lines("Suggesting item 8") + results.stdout.fnmatch_lines("Suggesting item 9") + + def test_window_log_message_fail(pytester: pytest.Pytester): """Ensure that the initial getting started example fails as expected.""" diff --git a/lib/pytest-lsp/tests/test_plugin.py b/lib/pytest-lsp/tests/test_plugin.py index 1cb06d5..6934062 100644 --- a/lib/pytest-lsp/tests/test_plugin.py +++ b/lib/pytest-lsp/tests/test_plugin.py @@ -195,7 +195,7 @@ async def test_capabilities(client): else: message = [ "E*asyncio.exceptions.CancelledError: Server process exited with return code: 1", # noqa: E501 - "E*ZeroDivisionError: division by zero", + "ZeroDivisionError: division by zero", ] results.stdout.fnmatch_lines(message)