[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
feature/eglot2emacs 2a12f622dc 087/120: Eglot-workspace-configuration ca
From: |
João Távora |
Subject: |
feature/eglot2emacs 2a12f622dc 087/120: Eglot-workspace-configuration can be a function |
Date: |
Thu, 20 Oct 2022 07:17:01 -0400 (EDT) |
branch: feature/eglot2emacs
commit 2a12f622dcd69ae7cd2457c8f1fff2b7912dc47d
Author: João Távora <joaotavora@gmail.com>
Commit: João Távora <joaotavora@gmail.com>
Eglot-workspace-configuration can be a function
* README.md (Workspace configuration): Renamed from per-project
configuration. Rework.
* NEWS.md: Mention change.
* eglot.el (eglot-workspace-configuration): Overhaul.
(eglot-signal-didChangeConfiguration): Use new
eglot-workspace-configuration.
GitHub-reference: per https://github.com/joaotavora/eglot/issues/967
---
lisp/progmodes/eglot.el | 18 ++++++++++++++----
1 file changed, 14 insertions(+), 4 deletions(-)
diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el
index 0b64cd2301..582ad1fdee 100644
--- a/lisp/progmodes/eglot.el
+++ b/lisp/progmodes/eglot.el
@@ -2199,12 +2199,22 @@ Records BEG, END and PRE-CHANGE-LENGTH locally."
(defvar-local eglot-workspace-configuration ()
"Alist of (SECTION . VALUE) entries configuring the LSP server.
-SECTION should be a keyword or a string, value can be anything
-that can be converted to JSON.")
+SECTION should be a keyword or a string. VALUE is a
+plist or a primitive type converted to JSON.
+
+The value of this variable can also be a unary function of a
+`eglot-lsp-server' instance, the server connection requesting the
+configuration. It should return an alist of the format described
+above.")
;;;###autoload
(put 'eglot-workspace-configuration 'safe-local-variable 'listp)
+(defun eglot--workspace-configuration (server)
+ (if (functionp eglot-workspace-configuration)
+ (funcall eglot-workspace-configuration server)
+ eglot-workspace-configuration))
+
(defun eglot-signal-didChangeConfiguration (server)
"Send a `:workspace/didChangeConfiguration' signal to SERVER.
When called interactively, use the currently active server"
@@ -2213,7 +2223,7 @@ When called interactively, use the currently active
server"
server :workspace/didChangeConfiguration
(list
:settings
- (or (cl-loop for (section . v) in eglot-workspace-configuration
+ (or (cl-loop for (section . v) in (eglot--workspace-configuration server)
collect (if (keywordp section)
section
(intern (format ":%s" section)))
@@ -2235,7 +2245,7 @@ When called interactively, use the currently active
server"
(project-root (eglot--project server)))))
(setq-local major-mode (eglot--major-mode server))
(hack-dir-local-variables-non-file-buffer)
- (alist-get section eglot-workspace-configuration
+ (alist-get section (eglot--workspace-configuration server)
nil nil
(lambda (wsection section)
(string=
- feature/eglot2emacs 9801e217f9 118/120: Rework header of eglot.el, (continued)
- feature/eglot2emacs 9801e217f9 118/120: Rework header of eglot.el, João Távora, 2022/10/20
- feature/eglot2emacs 77f3157dcd 048/120: Use new jdtls script for eclipse jdt, João Távora, 2022/10/20
- feature/eglot2emacs 349f6b5f78 050/120: Don't advertise didchangewatchedfiles on tramp, João Távora, 2022/10/20
- feature/eglot2emacs 965e1378f1 053/120: Use bounds of thing at point when asking for code actions, João Távora, 2022/10/20
- feature/eglot2emacs a38ce8b28f 052/120: Add simple support for workspacefolders, João Távora, 2022/10/20
- feature/eglot2emacs cb562118cb 047/120: Don't strip invisible text when formatting hover string, João Távora, 2022/10/20
- feature/eglot2emacs 904556f662 058/120: Easier initializationoptions in eglot-server-programs, João Távora, 2022/10/20
- feature/eglot2emacs 49e56e47d8 066/120: Solve flymake diagnostics synchronization problems, João Távora, 2022/10/20
- feature/eglot2emacs 917e8ffa31 080/120: Add support for jedi-language-server, João Távora, 2022/10/20
- feature/eglot2emacs 9dbc18cbfa 084/120: Tweak some details, fix some bugs, João Távora, 2022/10/20
- feature/eglot2emacs 2a12f622dc 087/120: Eglot-workspace-configuration can be a function,
João Távora <=
- feature/eglot2emacs 1986c4df88 089/120: Reply more reasonably to server's workspace/applyedit, João Távora, 2022/10/20
- feature/eglot2emacs bef332a983 101/120: Adjust last commit about workspace configuration, João Távora, 2022/10/20
- feature/eglot2emacs 523547321e 102/120: Allow :initializationoptions in eglot-server-programs, João Távora, 2022/10/20
- feature/eglot2emacs 68b9c03b44 106/120: Don't use three-argument plist-get, João Távora, 2022/10/20
- feature/eglot2emacs 0829d5e7a2 107/120: Revert "fix jdtls support", João Távora, 2022/10/20
- feature/eglot2emacs b205479035 108/120: Fix blunder in eglot--guess-contact, João Távora, 2022/10/20
- feature/eglot2emacs b07fa37d04 113/120: Add half-baked m-x eglot-list-connections, João Távora, 2022/10/20
- feature/eglot2emacs 4f1f06375a 045/120: Prevent empty diagnostic tags vector hiding main fontification, João Távora, 2022/10/20
- feature/eglot2emacs be47552331 049/120: Change capability 'documentchanges' to t, João Távora, 2022/10/20
- feature/eglot2emacs 27ba1994fe 038/120: ; fix thinko in last commit, João Távora, 2022/10/20