[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
feature/eglot2emacs e5f77f8ca5 100/120: Rework readme.md about workspace
From: |
João Távora |
Subject: |
feature/eglot2emacs e5f77f8ca5 100/120: Rework readme.md about workspace configuration again |
Date: |
Thu, 20 Oct 2022 07:17:07 -0400 (EDT) |
branch: feature/eglot2emacs
commit e5f77f8ca59b899bcc2b77e8e8eb27a2749a9130
Author: João Távora <joaotavora@gmail.com>
Commit: João Távora <joaotavora@gmail.com>
Rework readme.md about workspace configuration again
Also tweak eglot-show-workspace-configuration a bit.
* README.md (Workspace configuration): Rework.
* eglot.el (eglot-show-workspace-configuration): Rework.
(eglot--workspace-configuration-plist): New helper.
GitHub-reference: per https://github.com/joaotavora/eglot/issues/590
---
lisp/progmodes/eglot.el | 43 +++++++++++++++++++++++++------------------
1 file changed, 25 insertions(+), 18 deletions(-)
diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el
index 91733a8d7a..f02ec73043 100644
--- a/lisp/progmodes/eglot.el
+++ b/lisp/progmodes/eglot.el
@@ -58,7 +58,6 @@
;;; Code:
-(require 'json)
(require 'imenu)
(require 'cl-lib)
(require 'project)
@@ -2204,23 +2203,28 @@ 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.")
+single argument, which will be a connected `eglot-lsp-server'
+instance. The function runs with `default-directory' set to the
+root of the current project. It should return an alist of the
+format described above.")
;;;###autoload
(put 'eglot-workspace-configuration 'safe-local-variable 'listp)
-(defun eglot-show-configuration (server)
- "Dump `eglot-workspace-configuration' as json for debugging."
- (interactive (list (eglot--read-server "Server configuration"
- (eglot-current-server))))
- (let ((conf (eglot--workspace-configuration server)))
- (with-current-buffer (get-buffer-create " *eglot configuration*")
+(defun eglot-show-workspace-configuration (&optional server)
+ "Dump `eglot-workspace-configuration' as JSON for debugging."
+ (interactive (list (and (eglot-current-server)
+ (eglot--read-server "Server configuration"
+ (eglot-current-server)))))
+ (let ((conf (eglot--workspace-configuration-plist server)))
+ (with-current-buffer (get-buffer-create "*EGLOT workspace configuration*")
(erase-buffer)
(insert (jsonrpc--json-encode conf))
- (json-mode)
- (json-pretty-print-buffer)
+ (with-no-warnings
+ (require 'json)
+ (require 'json-mode)
+ (json-mode)
+ (json-pretty-print-buffer))
(pop-to-buffer (current-buffer)))))
(defun eglot--workspace-configuration (server)
@@ -2228,6 +2232,14 @@ above.")
(funcall eglot-workspace-configuration server)
eglot-workspace-configuration))
+(defun eglot--workspace-configuration-plist (server)
+ "Returns `eglot-workspace-configuraiton' suitable serialization."
+ (or (cl-loop for (section . v) in (eglot--workspace-configuration server)
+ collect (if (keywordp section) section
+ (intern (format ":%s" section)))
+ collect v)
+ eglot--{}))
+
(defun eglot-signal-didChangeConfiguration (server)
"Send a `:workspace/didChangeConfiguration' signal to SERVER.
When called interactively, use the currently active server"
@@ -2236,12 +2248,7 @@ When called interactively, use the currently active
server"
server :workspace/didChangeConfiguration
(list
:settings
- (or (cl-loop for (section . v) in (eglot--workspace-configuration server)
- collect (if (keywordp section)
- section
- (intern (format ":%s" section)))
- collect v)
- eglot--{}))))
+ (eglot--workspace-configuration-plist server))))
(cl-defmethod eglot-handle-request
(server (_method (eql workspace/configuration)) &key items)
- feature/eglot2emacs 0739cdcf20 031/120: Improve backwards-compatibility of eglot-mode-map, (continued)
- feature/eglot2emacs 0739cdcf20 031/120: Improve backwards-compatibility of eglot-mode-map, João Távora, 2022/10/20
- feature/eglot2emacs 9710754080 042/120: Add support for optional completionitem.tags, João Távora, 2022/10/20
- feature/eglot2emacs c2d97d22aa 056/120: Implement on-type-formatting support, João Távora, 2022/10/20
- feature/eglot2emacs 1d9542cbe8 059/120: Protect against empty firsttriggercharacter strings, João Távora, 2022/10/20
- feature/eglot2emacs a63916f928 062/120: Tweak eglot mode-line menus, João Távora, 2022/10/20
- feature/eglot2emacs 4beab004d9 070/120: Ensure exit-function of eglot-c-at-point runs on exact match, João Távora, 2022/10/20
- feature/eglot2emacs 29f2ec2471 071/120: Consider diagnostic.code when generating flymake diagnostics, João Távora, 2022/10/20
- feature/eglot2emacs cc5d1a5a72 091/120: Always default eglot-strict-mode to nil, João Távora, 2022/10/20
- feature/eglot2emacs e74e199912 093/120: Add out-of-box support for perl lsp server, João Távora, 2022/10/20
- feature/eglot2emacs d2e842bbf5 098/120: Prefer documentchanges to changes in server-initiated edits, João Távora, 2022/10/20
- feature/eglot2emacs e5f77f8ca5 100/120: Rework readme.md about workspace configuration again,
João Távora <=
- feature/eglot2emacs ec7d63cbe7 105/120: Don't return hash tables from e-w-configuration-plist, João Távora, 2022/10/20
- feature/eglot2emacs 1780b93d66 111/120: Make clojure-lsp handle more major modes at once, João Távora, 2022/10/20
- feature/eglot2emacs 0848387fa2 115/120: Fix docstring of eglot-list-connections-mode, João Távora, 2022/10/20
- feature/eglot2emacs cf0ba0197a 007/120: Add support for the mint language server, João Távora, 2022/10/20
- feature/eglot2emacs ed9800041e 029/120: * eglot.el (eglot--connect): display seconds on timeout., João Távora, 2022/10/20
- feature/eglot2emacs ef0da9414e 060/120: Make eglot--plist-keys a simple (non-map.el) helper again, João Távora, 2022/10/20
- feature/eglot2emacs 5e9d78f9cf 068/120: Ensure non-null :settings param in didchangeconfiguration notif, João Távora, 2022/10/20
- feature/eglot2emacs 73f4555a0d 067/120: Add out-of-box support for futhark lsp server, João Távora, 2022/10/20
- feature/eglot2emacs 50ff73d753 073/120: Use format string instead of concat, João Távora, 2022/10/20
- feature/eglot2emacs 68fbcbd620 076/120: Reduce memory footprint of eglot--{}, João Távora, 2022/10/20