From b72a067c7be82b1354e76169d1eeb0cc7778e37c Mon Sep 17 00:00:00 2001 From: Alex Carney Date: Sat, 21 Oct 2023 19:56:42 +0100 Subject: [PATCH] pre-commit: Add hook to check client capabilities - Ensure that the data can be parsed as `InitializeParams` - Ensure that the JSON files are formatted consistently --- .pre-commit-config.yaml | 11 + .../pytest_lsp/clients/neovim_v0.6.1.json | 2 +- .../pytest_lsp/clients/neovim_v0.7.0.json | 456 +++++++------- .../pytest_lsp/clients/neovim_v0.8.0.json | 460 +++++++------- .../pytest_lsp/clients/neovim_v0.9.1.json | 568 +++++++++--------- .../clients/visual_studio_code_v1.65.2.json | 2 +- scripts/check_capabilities.py | 33 + 7 files changed, 789 insertions(+), 743 deletions(-) create mode 100644 scripts/check_capabilities.py diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 9265d8b..4493b7e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -6,6 +6,7 @@ repos: hooks: - id: check-yaml - id: end-of-file-fixer + exclude: 'lib/pytest-lsp/pytest_lsp/clients/.*\.json' - id: trailing-whitespace - repo: https://github.com/psf/black @@ -62,3 +63,13 @@ repos: - textual - websockets files: 'lib/lsp-devtools/lsp_devtools/.*\.py' + +- repo: local + hooks: + - id: check-capabilities + name: check-capabilities + language: python + additional_dependencies: + - lsprotocol + files: 'lib/pytest-lsp/pytest_lsp/clients/.*\.json' + entry: python scripts/check_capabilities.py diff --git a/lib/pytest-lsp/pytest_lsp/clients/neovim_v0.6.1.json b/lib/pytest-lsp/pytest_lsp/clients/neovim_v0.6.1.json index 61c79b2..4970156 100644 --- a/lib/pytest-lsp/pytest_lsp/clients/neovim_v0.6.1.json +++ b/lib/pytest-lsp/pytest_lsp/clients/neovim_v0.6.1.json @@ -228,4 +228,4 @@ } } } -} +} \ No newline at end of file diff --git a/lib/pytest-lsp/pytest_lsp/clients/neovim_v0.7.0.json b/lib/pytest-lsp/pytest_lsp/clients/neovim_v0.7.0.json index 593f24a..bacf117 100644 --- a/lib/pytest-lsp/pytest_lsp/clients/neovim_v0.7.0.json +++ b/lib/pytest-lsp/pytest_lsp/clients/neovim_v0.7.0.json @@ -1,234 +1,234 @@ { - "capabilities": { - "window": { - "workDoneProgress": true, - "showMessage": { - "messageActionItem": { - "additionalPropertiesSupport": false - } - }, - "showDocument": { - "support": false - } - }, - "textDocument": { - "documentSymbol": { - "hierarchicalDocumentSymbolSupport": true, - "dynamicRegistration": false, - "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 - ] - } - }, - "rename": { - "prepareSupport": true, - "dynamicRegistration": false - }, - "references": { - "dynamicRegistration": false - }, - "documentHighlight": { - "dynamicRegistration": false - }, - "hover": { - "contentFormat": [ - "markdown", - "plaintext" - ], - "dynamicRegistration": false - }, - "implementation": { - "linkSupport": true - }, - "synchronization": { - "didSave": true, - "dynamicRegistration": false, - "willSave": false, - "willSaveWaitUntil": false - }, - "declaration": { - "linkSupport": true - }, - "publishDiagnostics": { - "tagSupport": { - "valueSet": [ - 1, - 2 - ] - }, - "relatedInformation": true - }, - "completion": { - "completionItemKind": { - "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 - ] - }, - "dynamicRegistration": false, - "contextSupport": false, - "completionItem": { - "documentationFormat": [ - "markdown", - "plaintext" - ], - "snippetSupport": false, - "commitCharactersSupport": false, - "preselectSupport": false, - "deprecatedSupport": false - } - }, - "definition": { - "linkSupport": true - }, - "typeDefinition": { - "linkSupport": true - }, - "codeAction": { - "resolveSupport": { - "properties": [ - "edit" - ] - }, - "dynamicRegistration": false, - "codeActionLiteralSupport": { - "codeActionKind": { - "valueSet": [ - "", - "Empty", - "QuickFix", - "Refactor", - "RefactorExtract", - "RefactorInline", - "RefactorRewrite", - "Source", - "SourceOrganizeImports", - "quickfix", - "refactor", - "refactor.extract", - "refactor.inline", - "refactor.rewrite", - "source", - "source.organizeImports" - ] - } - }, - "dataSupport": true - }, - "signatureHelp": { - "signatureInformation": { - "documentationFormat": [ - "markdown", - "plaintext" - ], - "activeParameterSupport": true, - "parameterInformation": { - "labelOffsetSupport": true - } - }, - "dynamicRegistration": false - } + "capabilities": { + "window": { + "workDoneProgress": true, + "showMessage": { + "messageActionItem": { + "additionalPropertiesSupport": false + } + }, + "showDocument": { + "support": false + } + }, + "textDocument": { + "documentSymbol": { + "hierarchicalDocumentSymbolSupport": true, + "dynamicRegistration": false, + "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 + ] + } + }, + "rename": { + "prepareSupport": true, + "dynamicRegistration": false + }, + "references": { + "dynamicRegistration": false + }, + "documentHighlight": { + "dynamicRegistration": false + }, + "hover": { + "contentFormat": [ + "markdown", + "plaintext" + ], + "dynamicRegistration": false + }, + "implementation": { + "linkSupport": true + }, + "synchronization": { + "didSave": true, + "dynamicRegistration": false, + "willSave": false, + "willSaveWaitUntil": false + }, + "declaration": { + "linkSupport": true + }, + "publishDiagnostics": { + "tagSupport": { + "valueSet": [ + 1, + 2 + ] }, - "callHierarchy": { - "dynamicRegistration": false + "relatedInformation": true + }, + "completion": { + "completionItemKind": { + "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 + ] }, - "workspace": { - "workspaceEdit": { - "resourceOperations": [ - "rename", - "create", - "delete" - ] - }, - "applyEdit": true, - "symbol": { - "dynamicRegistration": false, - "hierarchicalWorkspaceSymbolSupport": 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 - ] - } - }, - "workspaceFolders": true + "dynamicRegistration": false, + "contextSupport": false, + "completionItem": { + "documentationFormat": [ + "markdown", + "plaintext" + ], + "snippetSupport": false, + "commitCharactersSupport": false, + "preselectSupport": false, + "deprecatedSupport": false } + }, + "definition": { + "linkSupport": true + }, + "typeDefinition": { + "linkSupport": true + }, + "codeAction": { + "resolveSupport": { + "properties": [ + "edit" + ] + }, + "dynamicRegistration": false, + "codeActionLiteralSupport": { + "codeActionKind": { + "valueSet": [ + "", + "Empty", + "QuickFix", + "Refactor", + "RefactorExtract", + "RefactorInline", + "RefactorRewrite", + "Source", + "SourceOrganizeImports", + "quickfix", + "refactor", + "refactor.extract", + "refactor.inline", + "refactor.rewrite", + "source", + "source.organizeImports" + ] + } + }, + "dataSupport": true + }, + "signatureHelp": { + "signatureInformation": { + "documentationFormat": [ + "markdown", + "plaintext" + ], + "activeParameterSupport": true, + "parameterInformation": { + "labelOffsetSupport": true + } + }, + "dynamicRegistration": false + } }, - "clientInfo": { - "name": "Neovim", - "version": "0.7.0" + "callHierarchy": { + "dynamicRegistration": false + }, + "workspace": { + "workspaceEdit": { + "resourceOperations": [ + "rename", + "create", + "delete" + ] + }, + "applyEdit": true, + "symbol": { + "dynamicRegistration": false, + "hierarchicalWorkspaceSymbolSupport": 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 + ] + } + }, + "workspaceFolders": true } -} + }, + "clientInfo": { + "name": "Neovim", + "version": "0.7.0" + } +} \ No newline at end of file diff --git a/lib/pytest-lsp/pytest_lsp/clients/neovim_v0.8.0.json b/lib/pytest-lsp/pytest_lsp/clients/neovim_v0.8.0.json index 62ff6ba..3d0e10b 100644 --- a/lib/pytest-lsp/pytest_lsp/clients/neovim_v0.8.0.json +++ b/lib/pytest-lsp/pytest_lsp/clients/neovim_v0.8.0.json @@ -1,236 +1,236 @@ { - "clientInfo": { - "name": "Neovim", - "version": "0.8.0" + "clientInfo": { + "name": "Neovim", + "version": "0.8.0" + }, + "capabilities": { + "workspace": { + "configuration": true, + "applyEdit": true, + "workspaceEdit": { + "resourceOperations": [ + "rename", + "create", + "delete" + ] + }, + "workspaceFolders": true, + "symbol": { + "dynamicRegistration": false, + "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 + ] + }, + "hierarchicalWorkspaceSymbolSupport": true + } + }, + "window": { + "workDoneProgress": true, + "showMessage": { + "messageActionItem": { + "additionalPropertiesSupport": false + } + }, + "showDocument": { + "support": false + } }, - "capabilities": { - "workspace": { - "configuration": true, - "applyEdit": true, - "workspaceEdit": { - "resourceOperations": [ - "rename", - "create", - "delete" - ] - }, - "workspaceFolders": true, - "symbol": { - "dynamicRegistration": false, - "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 - ] - }, - "hierarchicalWorkspaceSymbolSupport": true - } + "callHierarchy": { + "dynamicRegistration": false + }, + "textDocument": { + "synchronization": { + "didSave": true, + "dynamicRegistration": false, + "willSave": false, + "willSaveWaitUntil": false + }, + "documentSymbol": { + "dynamicRegistration": false, + "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 + ] }, - "window": { - "workDoneProgress": true, - "showMessage": { - "messageActionItem": { - "additionalPropertiesSupport": false - } - }, - "showDocument": { - "support": false - } + "hierarchicalDocumentSymbolSupport": true + }, + "declaration": { + "linkSupport": true + }, + "hover": { + "contentFormat": [ + "markdown", + "plaintext" + ], + "dynamicRegistration": false + }, + "definition": { + "linkSupport": true + }, + "implementation": { + "linkSupport": true + }, + "typeDefinition": { + "linkSupport": true + }, + "publishDiagnostics": { + "relatedInformation": true, + "tagSupport": { + "valueSet": [ + 1, + 2 + ] + } + }, + "signatureHelp": { + "signatureInformation": { + "activeParameterSupport": true, + "documentationFormat": [ + "markdown", + "plaintext" + ], + "parameterInformation": { + "labelOffsetSupport": true + } }, - "callHierarchy": { - "dynamicRegistration": false + "dynamicRegistration": false + }, + "rename": { + "prepareSupport": true, + "dynamicRegistration": false + }, + "completion": { + "dynamicRegistration": false, + "completionItem": { + "deprecatedSupport": false, + "documentationFormat": [ + "markdown", + "plaintext" + ], + "commitCharactersSupport": false, + "snippetSupport": false, + "preselectSupport": false }, - "textDocument": { - "synchronization": { - "didSave": true, - "dynamicRegistration": false, - "willSave": false, - "willSaveWaitUntil": false - }, - "documentSymbol": { - "dynamicRegistration": false, - "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 - ] - }, - "hierarchicalDocumentSymbolSupport": true - }, - "declaration": { - "linkSupport": true - }, - "hover": { - "contentFormat": [ - "markdown", - "plaintext" - ], - "dynamicRegistration": false - }, - "definition": { - "linkSupport": true - }, - "implementation": { - "linkSupport": true - }, - "typeDefinition": { - "linkSupport": true - }, - "publishDiagnostics": { - "relatedInformation": true, - "tagSupport": { - "valueSet": [ - 1, - 2 - ] - } - }, - "signatureHelp": { - "signatureInformation": { - "activeParameterSupport": true, - "documentationFormat": [ - "markdown", - "plaintext" - ], - "parameterInformation": { - "labelOffsetSupport": true - } - }, - "dynamicRegistration": false - }, - "rename": { - "prepareSupport": true, - "dynamicRegistration": false - }, - "completion": { - "dynamicRegistration": false, - "completionItem": { - "deprecatedSupport": false, - "documentationFormat": [ - "markdown", - "plaintext" - ], - "commitCharactersSupport": false, - "snippetSupport": false, - "preselectSupport": false - }, - "completionItemKind": { - "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 - ] - }, - "contextSupport": false - }, - "documentHighlight": { - "dynamicRegistration": false - }, - "codeAction": { - "dynamicRegistration": false, - "dataSupport": true, - "resolveSupport": { - "properties": [ - "edit" - ] - }, - "codeActionLiteralSupport": { - "codeActionKind": { - "valueSet": [ - "", - "Empty", - "QuickFix", - "Refactor", - "RefactorExtract", - "RefactorInline", - "RefactorRewrite", - "Source", - "SourceOrganizeImports", - "quickfix", - "refactor", - "refactor.extract", - "refactor.inline", - "refactor.rewrite", - "source", - "source.organizeImports" - ] - } - }, - "isPreferredSupport": true - }, - "references": { - "dynamicRegistration": false - } - } + "completionItemKind": { + "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 + ] + }, + "contextSupport": false + }, + "documentHighlight": { + "dynamicRegistration": false + }, + "codeAction": { + "dynamicRegistration": false, + "dataSupport": true, + "resolveSupport": { + "properties": [ + "edit" + ] + }, + "codeActionLiteralSupport": { + "codeActionKind": { + "valueSet": [ + "", + "Empty", + "QuickFix", + "Refactor", + "RefactorExtract", + "RefactorInline", + "RefactorRewrite", + "Source", + "SourceOrganizeImports", + "quickfix", + "refactor", + "refactor.extract", + "refactor.inline", + "refactor.rewrite", + "source", + "source.organizeImports" + ] + } + }, + "isPreferredSupport": true + }, + "references": { + "dynamicRegistration": false + } } -} + } +} \ No newline at end of file diff --git a/lib/pytest-lsp/pytest_lsp/clients/neovim_v0.9.1.json b/lib/pytest-lsp/pytest_lsp/clients/neovim_v0.9.1.json index a0088c3..b07184b 100644 --- a/lib/pytest-lsp/pytest_lsp/clients/neovim_v0.9.1.json +++ b/lib/pytest-lsp/pytest_lsp/clients/neovim_v0.9.1.json @@ -1,288 +1,290 @@ { - "clientInfo": { - "version": "0.9.1", - "name": "Neovim" - }, - "capabilities": { - "textDocument": { - "declaration": { - "linkSupport": true - }, - "synchronization": { - "didSave": true, - "willSave": true, - "dynamicRegistration": false, - "willSaveWaitUntil": true - }, - "callHierarchy": { - "dynamicRegistration": false - }, - "codeAction": { - "isPreferredSupport": true, - "dataSupport": true, - "resolveSupport": { - "properties": [ - "edit" - ] - }, - "codeActionLiteralSupport": { - "codeActionKind": { - "valueSet": [ - "", - "quickfix", - "refactor", - "refactor.extract", - "refactor.inline", - "refactor.rewrite", - "source", - "source.organizeImports" - ] - } - }, - "dynamicRegistration": false - }, - "publishDiagnostics": { - "tagSupport": { - "valueSet": [ - 1, - 2 - ] - }, - "relatedInformation": true - }, - "rename": { - "dynamicRegistration": false, - "prepareSupport": true - }, - "implementation": { - "linkSupport": true - }, - "typeDefinition": { - "linkSupport": true - }, - "documentSymbol": { - "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 - ] - }, - "dynamicRegistration": false, - "hierarchicalDocumentSymbolSupport": true - }, - "signatureHelp": { - "dynamicRegistration": false, - "signatureInformation": { - "parameterInformation": { - "labelOffsetSupport": true - }, - "documentationFormat": [ - "markdown", - "plaintext" - ], - "activeParameterSupport": true - } - }, - "hover": { - "dynamicRegistration": false, - "contentFormat": [ - "markdown", - "plaintext" - ] - }, - "definition": { - "linkSupport": true - }, - "completion": { - "contextSupport": false, - "completionItem": { - "preselectSupport": false, - "deprecatedSupport": false, - "documentationFormat": [ - "markdown", - "plaintext" - ], - "snippetSupport": false, - "commitCharactersSupport": false - }, - "dynamicRegistration": false, - "completionItemKind": { - "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 - ] - } - }, - "semanticTokens": { - "augmentsSyntaxTokens": true, - "requests": { - "range": false, - "full": { - "delta": true - } - }, - "tokenModifiers": [ - "declaration", - "definition", - "readonly", - "static", - "deprecated", - "abstract", - "async", - "modification", - "documentation", - "defaultLibrary" - ], - "formats": [ - "relative" - ], - "dynamicRegistration": false, - "tokenTypes": [ - "namespace", - "type", - "class", - "enum", - "interface", - "struct", - "typeParameter", - "parameter", - "variable", - "property", - "enumMember", - "event", - "function", - "method", - "macro", - "keyword", - "modifier", - "comment", - "string", - "number", - "regexp", - "operator", - "decorator" - ], - "overlappingTokenSupport": true, - "multilineTokenSupport": false, - "serverCancelSupport": false - }, - "references": { - "dynamicRegistration": false - }, - "documentHighlight": { - "dynamicRegistration": false - } + "clientInfo": { + "version": "0.9.1", + "name": "Neovim" + }, + "capabilities": { + "textDocument": { + "declaration": { + "linkSupport": true + }, + "synchronization": { + "didSave": true, + "willSave": true, + "dynamicRegistration": false, + "willSaveWaitUntil": true + }, + "callHierarchy": [ + { + "dynamicRegistration": false + } + ], + "codeAction": { + "isPreferredSupport": true, + "dataSupport": true, + "resolveSupport": { + "properties": [ + "edit" + ] + }, + "codeActionLiteralSupport": { + "codeActionKind": { + "valueSet": [ + "", + "quickfix", + "refactor", + "refactor.extract", + "refactor.inline", + "refactor.rewrite", + "source", + "source.organizeImports" + ] + } }, - "window": { - "showDocument": { - "support": true - }, - "workDoneProgress": true, - "showMessage": { - "messageActionItem": { - "additionalPropertiesSupport": false - } - } + "dynamicRegistration": false + }, + "publishDiagnostics": { + "tagSupport": { + "valueSet": [ + 1, + 2 + ] + }, + "relatedInformation": true + }, + "rename": { + "dynamicRegistration": false, + "prepareSupport": true + }, + "implementation": { + "linkSupport": true + }, + "typeDefinition": { + "linkSupport": true + }, + "documentSymbol": { + "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 + ] + }, + "dynamicRegistration": false, + "hierarchicalDocumentSymbolSupport": true + }, + "signatureHelp": { + "dynamicRegistration": false, + "signatureInformation": { + "parameterInformation": { + "labelOffsetSupport": true + }, + "documentationFormat": [ + "markdown", + "plaintext" + ], + "activeParameterSupport": true + } + }, + "hover": { + "dynamicRegistration": false, + "contentFormat": [ + "markdown", + "plaintext" + ] + }, + "definition": { + "linkSupport": true + }, + "completion": { + "contextSupport": false, + "completionItem": { + "preselectSupport": false, + "deprecatedSupport": false, + "documentationFormat": [ + "markdown", + "plaintext" + ], + "snippetSupport": false, + "commitCharactersSupport": false }, - "workspace": { - "workspaceFolders": true, - "configuration": true, - "applyEdit": true, - "workspaceEdit": { - "resourceOperations": [ - "rename", - "create", - "delete" - ] - }, - "semanticTokens": { - "refreshSupport": true - }, - "symbol": { - "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 - ] - }, - "dynamicRegistration": false, - "hierarchicalWorkspaceSymbolSupport": true - }, - "didChangeWatchedFiles": { - "dynamicRegistration": false, - "relativePatternSupport": true - } + "dynamicRegistration": false, + "completionItemKind": { + "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 + ] } + }, + "semanticTokens": { + "augmentsSyntaxTokens": true, + "requests": { + "range": false, + "full": { + "delta": true + } + }, + "tokenModifiers": [ + "declaration", + "definition", + "readonly", + "static", + "deprecated", + "abstract", + "async", + "modification", + "documentation", + "defaultLibrary" + ], + "formats": [ + "relative" + ], + "dynamicRegistration": false, + "tokenTypes": [ + "namespace", + "type", + "class", + "enum", + "interface", + "struct", + "typeParameter", + "parameter", + "variable", + "property", + "enumMember", + "event", + "function", + "method", + "macro", + "keyword", + "modifier", + "comment", + "string", + "number", + "regexp", + "operator", + "decorator" + ], + "overlappingTokenSupport": true, + "multilineTokenSupport": false, + "serverCancelSupport": false + }, + "references": { + "dynamicRegistration": false + }, + "documentHighlight": { + "dynamicRegistration": false + } + }, + "window": { + "showDocument": { + "support": true + }, + "workDoneProgress": true, + "showMessage": { + "messageActionItem": { + "additionalPropertiesSupport": false + } + } + }, + "workspace": { + "workspaceFolders": true, + "configuration": true, + "applyEdit": true, + "workspaceEdit": { + "resourceOperations": [ + "rename", + "create", + "delete" + ] + }, + "semanticTokens": { + "refreshSupport": true + }, + "symbol": { + "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 + ] + }, + "dynamicRegistration": false, + "hierarchicalWorkspaceSymbolSupport": true + }, + "didChangeWatchedFiles": { + "dynamicRegistration": false, + "relativePatternSupport": true + } } -} + } +} \ No newline at end of file diff --git a/lib/pytest-lsp/pytest_lsp/clients/visual_studio_code_v1.65.2.json b/lib/pytest-lsp/pytest_lsp/clients/visual_studio_code_v1.65.2.json index 9c09b2b..658b004 100644 --- a/lib/pytest-lsp/pytest_lsp/clients/visual_studio_code_v1.65.2.json +++ b/lib/pytest-lsp/pytest_lsp/clients/visual_studio_code_v1.65.2.json @@ -386,4 +386,4 @@ } } } -} +} \ No newline at end of file diff --git a/scripts/check_capabilities.py b/scripts/check_capabilities.py new file mode 100644 index 0000000..5cccde7 --- /dev/null +++ b/scripts/check_capabilities.py @@ -0,0 +1,33 @@ +import json +import pathlib +import sys + +from lsprotocol import types +from lsprotocol.converters import get_converter + + +def check(filepath: pathlib.Path, converter): + obj = json.loads(filepath.read_text()) + + try: + converter.structure(obj, types.InitializeParams) + except Exception as e: + print(f"{filepath.name}: {e}") + return 1 + + filepath.write_text(json.dumps(obj, indent=2)) + return 0 + + +def main(files: list[str]): + converter = get_converter() + + total = 0 + for filename in files: + total += check(pathlib.Path(filename), converter) + + return total + + +if __name__ == "__main__": + sys.exit(main(sys.argv[1:]))