all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#73280: 30.0.90; Eglot: eglot-workspace-configuration might not be found in .dir-locals.el
@ 2024-09-15 19:54 Troy Brown
  2024-09-16 11:38 ` Eli Zaretskii
  0 siblings, 1 reply; 12+ messages in thread
From: Troy Brown @ 2024-09-15 19:54 UTC (permalink / raw)
  To: 73280; +Cc: João Távora

I discovered that the workspace configuration specified in a
`.dir-locals.el` file was not being used if the mode is not listed
first in `eglot-server-programs`.  Consider a scenario where the
current buffer's major mode is `ada-ts-mode` and Eglot is enabled in
that buffer.  Also, consider the following `.dir-locals.el` in a
parent directory containing the file of the buffer.

```elisp
((ada-ts-mode . ((eglot-workspace-configuration . (:ada (:projectFile
"src/gtkada.gpr"))))))
```

If I then execute `M-x eglot-show-workspace-configuration RET` in that
`ada-ts-mode` buffer, the "*EGLOT workspace configuration*" buffer
opens and displays a value of "null".

```json
null
```

However, if I change the mode in `.dir-locals.el` from `ada-ts-mode`
to `ada-mode` and repeat the "show configuration" command, I see the
configuration as expected, even though the major mode is
`ada-ts-mode`.

```json
{
  "ada": {
    "projectFile": "src/gtkada.gpr"
  }
}
```

I believe this is due to the following statement in
`eglot--workspace-configuration-plist`, which sets the major mode in
the temporary buffer before calling
`hack-dir-local-variables-non-file-buffer`:

```elisp
;; Set the major mode to be the first of the managed
;; modes.  This is the one the user started eglot in.
(setq major-mode (car (eglot--major-modes server)))
```

The comment indicates that the major mode that Eglot was started in
will be listed first, but that is not the case.  If I execute `M-:
(eglot--major-modes (eglot-current-server))` from the `ada-ts-mode`
buffer, the value is `(ada-mode ada-ts-mode)`, which is the same order
they are listed in `eglot-server-programs`, and is not ordered based
on the major mode of the buffer where Eglot was started.
Additionally, `eglot--connect` which populates `eglot--languages`
doesn't change the order from how they are listed in
`eglot-server-programs`.





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

end of thread, other threads:[~2024-09-16 21:34 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-15 19:54 bug#73280: 30.0.90; Eglot: eglot-workspace-configuration might not be found in .dir-locals.el Troy Brown
2024-09-16 11:38 ` Eli Zaretskii
2024-09-16 13:48   ` João Távora
2024-09-16 17:07     ` Troy Brown
2024-09-16 18:15       ` Eli Zaretskii
2024-09-16 18:39         ` João Távora
2024-09-16 18:43           ` Eli Zaretskii
2024-09-16 18:53         ` Troy Brown
2024-09-16 19:07           ` João Távora
2024-09-16 21:34             ` Troy Brown
2024-09-16 19:17           ` Eli Zaretskii
2024-09-16 21:34   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.