[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 3b7273f4ae3: Eglot: add support for :codeAction/resolve
From: |
João Távora |
Subject: |
master 3b7273f4ae3: Eglot: add support for :codeAction/resolve |
Date: |
Mon, 10 Jul 2023 19:08:16 -0400 (EDT) |
branch: master
commit 3b7273f4ae3623962c5d5fdc922a62af1136f448
Author: João Távora <joaotavora@gmail.com>
Commit: João Távora <joaotavora@gmail.com>
Eglot: add support for :codeAction/resolve
See https://github.com/emacs-grammarly/eglot-grammarly/issues/7.
* lisp/progmodes/eglot.el (eglot--lsp-interface-alist): Augment
CodeAction type.
(eglot-execute): Consider :codeAction/resolve
(eglot-client-capabilities): Advertise
textDocument.codeAction.resolveSupport
---
lisp/progmodes/eglot.el | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el
index 537d8cac8ae..0c46e4a5290 100644
--- a/lisp/progmodes/eglot.el
+++ b/lisp/progmodes/eglot.el
@@ -463,7 +463,7 @@ This can be useful when using docker to run a language
server.")
(eval-and-compile
(defvar eglot--lsp-interface-alist
`(
- (CodeAction (:title) (:kind :diagnostics :edit :command :isPreferred))
+ (CodeAction (:title) (:kind :diagnostics :edit :command :isPreferred
:data))
(ConfigurationItem () (:scopeUri :section))
(Command ((:title . string) (:command . string)) (:arguments))
(CompletionItem (:label)
@@ -739,9 +739,12 @@ ACTION is an LSP object of either `CodeAction' or
`Command' type."
(server action) "Default implementation."
(eglot--dcase action
(((Command)) (eglot--request server :workspace/executeCommand action))
- (((CodeAction) edit command)
- (when edit (eglot--apply-workspace-edit edit))
- (when command (eglot--request server :workspace/executeCommand
command))))))
+ (((CodeAction) edit command data)
+ (if (and (null edit) (null command) data
+ (eglot--server-capable :codeActionProvider :resolveProvider))
+ (eglot-execute server (eglot--request server :codeAction/resolve
action))
+ (when edit (eglot--apply-workspace-edit edit))
+ (when command (eglot--request server :workspace/executeCommand
command)))))))
(cl-defgeneric eglot-initialization-options (server)
"JSON object to send under `initializationOptions'."
@@ -825,6 +828,7 @@ ACTION is an LSP object of either `CodeAction' or `Command'
type."
:documentHighlight `(:dynamicRegistration :json-false)
:codeAction (list
:dynamicRegistration :json-false
+ :resolveSupport t :dataSupport t
:codeActionLiteralSupport
'(:codeActionKind
(:valueSet
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 3b7273f4ae3: Eglot: add support for :codeAction/resolve,
João Távora <=