aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoão Távora2024-01-01 15:12:28 -0600
committerJoão Távora2024-01-01 15:12:43 -0600
commit24741d25633084101ab697ba6e28f03e1cdc8b7a (patch)
treec9650866b9740585e52a34dd13acea626f09847c
parent6e2e34a5caa75a3430a1fb0d89900f9911c50436 (diff)
downloademacs-24741d25633084101ab697ba6e28f03e1cdc8b7a.tar.gz
emacs-24741d25633084101ab697ba6e28f03e1cdc8b7a.zip
Eglot: filter by prefix in narrow-scope eglot-code-actions
Github-reference: https://github.com/joaotavora/eglot/issues/847 Servers like typescript-language-server, when asked for {"only" : "source.organizeImports"}, return actions with the "source.organizeImports.ts" kind. Eglot rejected these actions, but according to the spec: Kinds are a hierarchical list of identifiers separated by `.` [...] The set of kinds is open. So I guess we can use string-prefix-p * lisp/progmodes/eglot.el (eglot-code-actions): Use string-prefix-p.
-rw-r--r--lisp/progmodes/eglot.el3
1 files changed, 2 insertions, 1 deletions
diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el
index 048cf19213c..21f485bd349 100644
--- a/lisp/progmodes/eglot.el
+++ b/lisp/progmodes/eglot.el
@@ -3649,7 +3649,8 @@ at point. With prefix argument, prompt for ACTION-KIND."
3649 ;; Redo filtering, in case the `:only' didn't go through. 3649 ;; Redo filtering, in case the `:only' didn't go through.
3650 (actions (cl-loop for a across actions 3650 (actions (cl-loop for a across actions
3651 when (or (not action-kind) 3651 when (or (not action-kind)
3652 (equal action-kind (plist-get a :kind))) 3652 ;; github#847
3653 (string-prefix-p action-kind (plist-get a :kind)))
3653 collect a))) 3654 collect a)))
3654 (if interactive 3655 (if interactive
3655 (eglot--read-execute-code-action actions server action-kind) 3656 (eglot--read-execute-code-action actions server action-kind)