unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Niels Thykier <niels@thykier.net>
To: "João Távora" <joaotavora@gmail.com>, "Eli Zaretskii" <eliz@gnu.org>
Cc: 72088@debbugs.gnu.org
Subject: bug#72088: eglot: Segregates language servers in a way that hampers polyglot language servers
Date: Sun, 14 Jul 2024 11:36:34 +0200	[thread overview]
Message-ID: <e414cbdd-b9bc-43c6-aa10-42f15118faac@thykier.net> (raw)
In-Reply-To: <CALDnm52fNAg0f96KH9sdvYxdfxpH1WR3zD2eSjuFWHp9_FzCig@mail.gmail.com>

João Távora:
> On Sun, Jul 14, 2024, 05:37 Eli Zaretskii <eliz@gnu.org> wrote:
> 
>> AFAIU, the OP tried to use the same LSP server for several languages,
>> or something like that.
>>
> 
> Yes, but how? What are the major modes in question? What information was
> added to eglot-server-programs, if any?
Hi,

The `eglot-server-programs` are defined as:

```
(with-eval-after-load 'eglot
     (add-to-list 'eglot-server-programs
             '(debian-control-mode . ("debputy" "lsp" "server")))
     (add-to-list 'eglot-server-programs
             '(debian-changelog-mode . ("debputy" "lsp" "server")))
     (add-to-list 'eglot-server-programs
             '(debian-copyright-mode . ("debputy" "lsp" "server")))
     (add-to-list 'eglot-server-programs
             '(makefile-gmake-mode . ("debputy" "lsp" "server")))
     (add-to-list 'eglot-server-programs
             '(yaml-mode . ("debputy" "lsp" "server")))
     (add-to-list 'eglot-server-programs
             '(debian-autopkgtest-control-mode . ("debputy" "lsp" 
"server")))
)
```

Concrete case I was debugging was a `debian/control` file 
(`debian-control-mode`) + a `debian/rules` file (`makefile-qmake-mode`).

The "debian-X" modes is coming from 
https://salsa.debian.org/emacsen-team/dpkg-dev-el. I did not remember 
actively installing the `makefile-qmake-mode`, so I assume it is bundled 
with emacs. The "yaml-mode" is elpa-yaml-mode 
(https://github.com/yoshiki/yaml-mode).

Note: The `makefile-gmake-mode` and `yaml-mode` registrations would 
ideally be restricted to specific file names (such as `debian/rules` and 
`debian/debputy.manifest`). Mentioning it mostly for the context (I have 
not looked into how to do that at an eglot level yet).

> Are the two different files in question in the same project?

Yes, as far as I can tell, eglot considers them to be in the same 
project. Concretely, the files are both in a .git repo and eglot reports 
the git root dir as a workspace folder to the server.

> The OP consistently conflates file type and
> major mode, which is not always true.

Apologies for that. The language server in question works with at least 
4 distinct syntactical formats (YAML, make, the debian changelog format 
plus 3 distinct deb822 files). You are correct that the 3 deb822 files 
do have different major modes despite being the same file format at a 
syntactical level.

Nevertheless, in the concrete case, the problem appears between two 
distinct file formats *and* major-modes.

> A simple example of a LSP server that
> manages different files in (slightly) different major modes (as long as in
> the same project) is clangd. But there are a few others, I think. The
> docstring of eglot-server-programs should be studied.
> 
> João
> 
>>
> 

I read through 
https://www.gnu.org/software/emacs/manual/html_node/eglot/Setting-Up-LSP-Servers.html 
and I do not see anything here that decides how to control whether one 
or two instances per project will be spawned.

Best regards,
Niels








  reply	other threads:[~2024-07-14  9:36 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-12 11:33 bug#72088: eglot: Segregates language servers in a way that hampers polyglot language servers Niels Thykier
2024-07-13  6:15 ` Eli Zaretskii
2024-07-13 16:29   ` João Távora
2024-07-14  4:37     ` Eli Zaretskii
2024-07-14  7:31       ` Niels Thykier
2024-07-14  8:01       ` João Távora
2024-07-14  9:36         ` Niels Thykier [this message]
2024-07-14  9:46           ` Niels Thykier
2024-07-14 10:30             ` Niels Thykier
2024-07-14  9:48           ` João Távora
2024-07-14 12:01             ` Niels Thykier
2024-07-14 13:21               ` 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=e414cbdd-b9bc-43c6-aa10-42f15118faac@thykier.net \
    --to=niels@thykier.net \
    --cc=72088@debbugs.gnu.org \
    --cc=eliz@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).