bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#61866: 29.0.60; Eglot: Dir-local workspace config doesn't work as de


From: Augusto Stoffel
Subject: bug#61866: 29.0.60; Eglot: Dir-local workspace config doesn't work as described
Date: Tue, 28 Feb 2023 13:38:37 +0100
User-agent: Gnus/5.13 (Gnus v5.13)

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.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]