unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#61866: 29.0.60; Eglot: Dir-local workspace config doesn't work as described
@ 2023-02-28 12:38 Augusto Stoffel
  2023-02-28 19:20 ` João Távora
  0 siblings, 1 reply; 6+ messages in thread
From: Augusto Stoffel @ 2023-02-28 12:38 UTC (permalink / raw)
  To: 61866; +Cc: João Távora

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.





^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-03-01  9:22 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-28 12:38 bug#61866: 29.0.60; Eglot: Dir-local workspace config doesn't work as described Augusto Stoffel
2023-02-28 19:20 ` João Távora
2023-02-28 20:26   ` Augusto Stoffel
2023-03-01  1:44     ` João Távora
2023-03-01  7:10       ` Augusto Stoffel
2023-03-01  9:22         ` João Távora

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).