From 1f47c8fbf4b145e4f8b42dc1aebf096e4cd159f9 Mon Sep 17 00:00:00 2001 From: Andy Stewart Date: Wed, 12 Jun 2024 12:10:05 +0800 Subject: [PATCH] Adjust default capabilities for LSP server, this patch maybe break some languages, feel free to report bug. --- core/lspserver.py | 208 ++++++++++++++++++++++++++------ langserver/csharp-ls.json | 247 +------------------------------------- 2 files changed, 172 insertions(+), 283 deletions(-) diff --git a/core/lspserver.py b/core/lspserver.py index 5c0b7198dd..02f8cd054a 100755 --- a/core/lspserver.py +++ b/core/lspserver.py @@ -332,52 +332,186 @@ def get_capabilities(self): merge_capabilites = merge(server_capabilities, { "workspace": { - "configuration": True, - "symbol": { - "resolveSupport": { - "properties": [] - } + "workspaceEdit": { + "documentChanges": True, + "resourceOperations": [ + "create", + "rename", + "delete" + ] + }, + "applyEdit": True, + "symbol": { + "symbolKind": { + "valueSet": list(range(1, 27)) } + }, + "executeCommand": { + "dynamicRegistration": True + }, + "workspaceFolders": True, + "configuration": True, + "codeLens": { + "refreshSupport": True + }, + "inlayHint": { + "refreshSupport": True + }, + "fileOperations": { + "didCreate": True, + "willCreate": True, + "didRename": True, + "willRename": True, + "didDelete": True, + "willDelete": True + } }, "textDocument": { - "completion": { - "completionItem": { - "snippetSupport": True, - "deprecatedSupport": True, - "tagSupport": { - "valueSet": [ - 1 - ] - }, - "resolveSupport": { - # rust-analyzer need add `additionalTextEdits` to enable auto-import. - "properties": ["documentation", "detail", "additionalTextEdits"] - } - } + "declaration": { + "dynamicRegistration": True, + "linkSupport": True + }, + "definition": { + "dynamicRegistration": True, + "linkSupport": True + }, + "references": { + "dynamicRegistration": True + }, + "implementation": { + "dynamicRegistration": True, + "linkSupport": True + }, + "typeDefinition": { + "dynamicRegistration": True, + "linkSupport": True + }, + "synchronization": { + "willSave": True, + "didSave": True, + "willSaveWaitUntil": True + }, + "documentSymbol": { + "symbolKind": { + "valueSet": list(range(1, 27)) }, - "codeAction": { - "dynamicRegistration": False, - "codeActionLiteralSupport": { - "codeActionKind": { - "valueSet": [ - "quickfix", - "refactor", - "refactor.extract", - "refactor.inline", - "refactor.rewrite", - "source", - "source.organizeImports" - ] - } - }, - "isPreferredSupport": True + "hierarchicalDocumentSymbolSupport": True + }, + "formatting": { + "dynamicRegistration": True + }, + "rangeFormatting": { + "dynamicRegistration": True + }, + "onTypeFormatting": { + "dynamicRegistration": True + }, + "rename": { + "dynamicRegistration": True, + "prepareSupport": True + }, + "codeAction": { + "dynamicRegistration": True, + "isPreferredSupport": True, + "codeActionLiteralSupport": { + "codeActionKind": { + "valueSet": [ + "", + "quickfix", + "refactor", + "refactor.extract", + "refactor.inline", + "refactor.rewrite", + "source", + "source.organizeImports" + ] + } }, "inlayHint": { "dynamicRegistration": False - } + }, + "resolveSupport": { + "properties": [ + "edit", + "command" + ] + }, + "dataSupport": True + }, + "completion": { + "completionItem": { + "snippetSupport": True, + "documentationFormat": [ + "markdown", + "plaintext" + ], + "resolveAdditionalTextEditsSupport": True, + "insertReplaceSupport": True, + "deprecatedSupport": True, + "resolveSupport": { + "properties": [ + "documentation", + "detail", + "additionalTextEdits", + "command" + ] + }, + "insertTextModeSupport": { + "valueSet": [ + 1, + 2 + ] + } + }, + "contextSupport": True, + "dynamicRegistration": True + }, + "signatureHelp": { + "signatureInformation": { + "parameterInformation": { + "labelOffsetSupport": True + } + }, + "dynamicRegistration": True + }, + "documentLink": { + "dynamicRegistration": True, + "tooltipSupport": True + }, + "hover": { + "dynamicRegistration": True + }, + "foldingRange": { + "dynamicRegistration": True + }, + "selectionRange": { + "dynamicRegistration": True + }, + "callHierarchy": { + "dynamicRegistration": True + }, + "typeHierarchy": { + "dynamicRegistration": True + }, + "publishDiagnostics": { + "relatedInformation": True, + "tagSupport": { + "valueSet": [ + 1, + 2 + ] + }, + "versionSupport": True + }, + "linkedEditingRange": { + "dynamicRegistration": True + } }, "window": { - "workDoneProgress": True + "workDoneProgress": True, + "showDocument": { + "support": True + } } }) diff --git a/langserver/csharp-ls.json b/langserver/csharp-ls.json index 0bea4b629d..528a7985e5 100644 --- a/langserver/csharp-ls.json +++ b/langserver/csharp-ls.json @@ -8,250 +8,5 @@ "solution": null } }, - "support-single-file": false, - "capabilities": { - "general": { - "positionEncodings": [ - "utf-32", - "utf-16" - ] - }, - "workspace": { - "workspaceEdit": { - "documentChanges": true, - "resourceOperations": [ - "create", - "rename", - "delete" - ] - }, - "applyEdit": 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 - ] - } - }, - "executeCommand": { - "dynamicRegistration": false - }, - "workspaceFolders": true, - "configuration": true, - "codeLens": { - "refreshSupport": true - }, - "inlayHint": { - "refreshSupport": false - }, - "fileOperations": { - "didCreate": false, - "willCreate": false, - "didRename": true, - "willRename": true, - "didDelete": false, - "willDelete": false - } - }, - "textDocument": { - "declaration": { - "dynamicRegistration": true, - "linkSupport": true - }, - "definition": { - "dynamicRegistration": true, - "linkSupport": true - }, - "references": { - "dynamicRegistration": true - }, - "implementation": { - "dynamicRegistration": true, - "linkSupport": true - }, - "typeDefinition": { - "dynamicRegistration": true, - "linkSupport": true - }, - "synchronization": { - "willSave": true, - "didSave": true, - "willSaveWaitUntil": 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 - ] - }, - "hierarchicalDocumentSymbolSupport": true - }, - "formatting": { - "dynamicRegistration": true - }, - "rangeFormatting": { - "dynamicRegistration": true - }, - "onTypeFormatting": { - "dynamicRegistration": true - }, - "rename": { - "dynamicRegistration": true, - "prepareSupport": true - }, - "codeAction": { - "dynamicRegistration": true, - "isPreferredSupport": true, - "codeActionLiteralSupport": { - "codeActionKind": { - "valueSet": [ - "", - "quickfix", - "refactor", - "refactor.extract", - "refactor.inline", - "refactor.rewrite", - "source", - "source.organizeImports" - ] - } - }, - "resolveSupport": { - "properties": [ - "edit", - "command" - ] - }, - "dataSupport": true - }, - "completion": { - "completionItem": { - "snippetSupport": false, - "documentationFormat": [ - "markdown", - "plaintext" - ], - "resolveAdditionalTextEditsSupport": true, - "insertReplaceSupport": true, - "deprecatedSupport": true, - "resolveSupport": { - "properties": [ - "documentation", - "detail", - "additionalTextEdits", - "command" - ] - }, - "insertTextModeSupport": { - "valueSet": [ - 1, - 2 - ] - } - }, - "contextSupport": true, - "dynamicRegistration": true - }, - "signatureHelp": { - "signatureInformation": { - "parameterInformation": { - "labelOffsetSupport": true - } - }, - "dynamicRegistration": true - }, - "documentLink": { - "dynamicRegistration": true, - "tooltipSupport": true - }, - "hover": { - "contentFormat": [ - "markdown", - "plaintext" - ], - "dynamicRegistration": true - }, - "foldingRange": { - "dynamicRegistration": true - }, - "selectionRange": { - "dynamicRegistration": true - }, - "callHierarchy": { - "dynamicRegistration": false - }, - "typeHierarchy": { - "dynamicRegistration": true - }, - "publishDiagnostics": { - "relatedInformation": true, - "tagSupport": { - "valueSet": [ - 1, - 2 - ] - }, - "versionSupport": true - }, - "linkedEditingRange": { - "dynamicRegistration": true - } - }, - "window": { - "workDoneProgress": true, - "showDocument": { - "support": true - } - } - } + "support-single-file": false }