unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Augusto Stoffel <arstoffel@gmail.com>
To: 61866@debbugs.gnu.org
Cc: "João Távora" <joaotavora@gmail.com>
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	[thread overview]
Message-ID: <87cz5uarsi.fsf@gmail.com> (raw)

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	other threads:[~2023-02-28 12:38 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-28 12:38 Augusto Stoffel [this message]
2023-02-28 19:20 ` bug#61866: 29.0.60; Eglot: Dir-local workspace config doesn't work as described 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87cz5uarsi.fsf@gmail.com \
    --to=arstoffel@gmail.com \
    --cc=61866@debbugs.gnu.org \
    --cc=joaotavora@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).