GNU bug report logs -
#61866
29.0.60; Eglot: Dir-local workspace config doesn't work as described
Previous Next
Reported by: Augusto Stoffel <arstoffel <at> gmail.com>
Date: Tue, 28 Feb 2023 12:39:02 UTC
Severity: normal
Found in version 29.0.60
Fixed in version 29.1
Done: Augusto Stoffel <arstoffel <at> gmail.com>
Bug is archived. No further changes may be made.
Full log
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
Quoting from the manual:
> Here’s an example of defining the workspace-configuration settings [...]
>
> ((python-mode
> . ((eglot-workspace-configuration
> . (:pylsp (:plugins (:jedi_completion (:include_params t
> :fuzzy t)
> :pylint (:enabled :json-false)))))))
> (go-mode
> . ((eglot-workspace-configuration
> . (:gopls (:usePlaceholders t))))))
The above doesn't work.
> Alternatively, the same configuration could be defined as follows:
> ((nil
> . ((eglot-workspace-configuration
> . (:pylsp (:plugins (:jedi_completion (:include_params t
> :fuzzy t)
> :pylint (:enabled :json-false)))
> :gopls (:usePlaceholders t))))))
But this version does.
To see why, patch eglot-signal-didChangeConfiguration as follows:
(defun eglot-signal-didChangeConfiguration (server)
"Send a `:workspace/didChangeConfiguration' signal to SERVER.
When called interactively, use the currently active server"
(interactive (list (eglot--current-server-or-lose)))
(message "=> %s %s" (current-buffer) default-directory)
(jsonrpc-notify ...)
Then you'll see that upon first starting the server, one gets:
=> *temp* ~/project_dir/
Presumably, the temp buffer is in fundamental mode. Note also that if
you later do `M-x eglot-signal-didChangeConfiguration RET', then the
that buffer's local value of `eglot-workspace-configuration' is used,
since:
=> actual_file.py ~/project_dir/subdir
[ This behavior is confusing and reinforces my opinion that server
information should be kept away from buffer-local variables.
Related glitch: if you have two servers running, A and B, and then,
from a buffer in project A you do
M-x eglot-show-workspace-configuration RET
and select server B in the prompt, you get server A's information. ]
There's probably no better place than dir-locals to store "workspace"
(aka project) configuration. But it would be better to then record this
configuration in the server object after it's read for .dir-locals.el,
and provide some UI to modify the configuration on the fly if desired.
This bug report was last modified 2 years and 102 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.