From e30f30417cdaf0178707859359c648cff4fc1266 Mon Sep 17 00:00:00 2001 From: Andy Stewart Date: Fri, 6 Oct 2023 10:25:11 +0800 Subject: [PATCH] diagnostic-ignore is not general protocol, use code action instead. --- README.md | 1 - README.zh-CN.md | 1 - core/fileaction.py | 7 ------- langserver/kotlin-language-server.json | 1 - langserver/pyright-background-analysis.json | 1 - langserver/pyright.json | 1 - lsp-bridge-diagnostic.el | 9 --------- lsp_bridge.py | 2 +- 8 files changed, 1 insertion(+), 22 deletions(-) diff --git a/README.md b/README.md index b939db5ccd..22d2967cd2 100644 --- a/README.md +++ b/README.md @@ -126,7 +126,6 @@ lsp-bridge first looks for the content of the first *.pub file in the `~/.ssh` d - `lsp-bridge-diagnostic-jump-prev`: Jump to the previous diagnostic position - `lsp-bridge-diagnostic-list`: List all diagnostic information - `lsp-bridge-diagnostic-copy`: Copy the current diagnostic information to the clipboard -- `lsp-bridge-diagnostic-ignore`: Insert comment to ignore the current diagnosis - `lsp-bridge-code-action`: Popup code action menu, you can pass special `actin-kind` to fix, `action-kind` can use one of "quickfix", "refactor", "refactor.extract", "refactor.inline", "refactor.rewrite", "source", "source.organizeImports", "source.fixAll" - `lsp-bridge-workspace-list-symbols`: List all symbols in workspace and jump to the symbol definition - `lsp-bridge-signature-help-fetch`: show signature help in minibuffer manually (move cursor to parameters area will show signature help automatically) diff --git a/README.zh-CN.md b/README.zh-CN.md index 35fa2de593..60e3fd0f6f 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -124,7 +124,6 @@ lsp-bridge 优先从`~/.ssh`目录下找第一个 *.pub 文件的内容作为远 - `lsp-bridge-diagnostic-jump-prev`: 跳转到上一个诊断位置 - `lsp-bridge-diagnostic-list`: 列出所有诊断信息 - `lsp-bridge-diagnostic-copy`: 拷贝当前诊断信息到剪切板 -- `lsp-bridge-diagnostic-ignore`: 插入注视忽略当前诊断 - `lsp-bridge-code-action`: 弹出代码修复菜单, 也可以指需要修复的代码动作类型: "quickfix", "refactor", "refactor.extract", "refactor.inline", "refactor.rewrite", "source", "source.organizeImports", "source.fixAll" - `lsp-bridge-workspace-list-symbols`: 列出工作区所有符号, 并跳转到符号定义 - `lsp-bridge-signature-help-fetch`: 在 minibuffer 显示参数信息 diff --git a/core/fileaction.py b/core/fileaction.py index dd7c7394a1..b99506ec31 100755 --- a/core/fileaction.py +++ b/core/fileaction.py @@ -226,13 +226,6 @@ def change_cursor(self, position): # Record change cursor time. self.last_change_cursor_time = time.time() - def ignore_diagnostic(self): - lsp_server = self.get_match_lsp_servers("completion")[0] - if "ignore-diagnostic" in lsp_server.server_info: - eval_in_emacs("lsp-bridge-diagnostic--ignore", lsp_server.server_info["ignore-diagnostic"]) - else: - message_emacs("Not found 'ignore_diagnostic' field in LSP server configure file.") - def get_diagnostics(self): diagnostics = [] diagnostic_count = 0 diff --git a/langserver/kotlin-language-server.json b/langserver/kotlin-language-server.json index 9996275e51..f0cd38b800 100644 --- a/langserver/kotlin-language-server.json +++ b/langserver/kotlin-language-server.json @@ -4,7 +4,6 @@ "command": [ "kotlin-language-server" ], - "ignore-diagnostic": "# type: ignore", "settings": { "kotlin.externalSources": { "autoConvertToKotlin": true, diff --git a/langserver/pyright-background-analysis.json b/langserver/pyright-background-analysis.json index 9444e0c49b..06d7c3ccea 100644 --- a/langserver/pyright-background-analysis.json +++ b/langserver/pyright-background-analysis.json @@ -6,7 +6,6 @@ "--stdio", "--cancellationReceive=file:%FILEHASH%" ], - "ignore-diagnostic": "# type: ignore", "settings": { "python.analysis": { "autoImportCompletions": true, diff --git a/langserver/pyright.json b/langserver/pyright.json index 26b4b1daa8..cf9431b58c 100644 --- a/langserver/pyright.json +++ b/langserver/pyright.json @@ -5,7 +5,6 @@ "pyright-langserver", "--stdio" ], - "ignore-diagnostic": "# type: ignore", "settings": { "python.analysis": { "autoImportCompletions": true, diff --git a/lsp-bridge-diagnostic.el b/lsp-bridge-diagnostic.el index cc32ad15b7..5a986682ab 100644 --- a/lsp-bridge-diagnostic.el +++ b/lsp-bridge-diagnostic.el @@ -320,15 +320,6 @@ You can set this value with `(2 3 4) if you just need render error diagnostic." (interactive) (lsp-bridge-call-file-api "list_diagnostics")) -(defun lsp-bridge-diagnostic-ignore() - (interactive) - (lsp-bridge-call-file-api "ignore_diagnostic")) - -(defun lsp-bridge-diagnostic--ignore (comment-string) - (setq-local lsp-bridge-prohibit-completion t) - (move-end-of-line 1) - (insert (format " %s" comment-string))) - (defun lsp-bridge-diagnostic--list (diagnostics) (let ((filepath acm-backend-lsp-filepath) (current-buffer (current-buffer)) diff --git a/lsp_bridge.py b/lsp_bridge.py index 35cc47cec2..9ed407091b 100755 --- a/lsp_bridge.py +++ b/lsp_bridge.py @@ -119,7 +119,7 @@ def init_search_backends(self): handler_subclasses = list(map(lambda cls: cls.name, Handler.__subclasses__())) for name in ["change_file", "update_file", "save_file", "try_completion", "change_cursor", - "ignore_diagnostic", "list_diagnostics", + "list_diagnostics", "try_code_action", "workspace_symbol"] + handler_subclasses: self.build_file_action_function(name)