unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Niels Thykier <niels@thykier.net>
To: 72088@debbugs.gnu.org
Subject: bug#72088: eglot: Segregates language servers in a way that hampers polyglot language servers
Date: Fri, 12 Jul 2024 13:33:56 +0200	[thread overview]
Message-ID: <6e65694c-88d6-4c54-93a8-2ffb843ce6d0@thykier.net> (raw)

Hi

Thanks for providing LSP support in emacs. :)


For reference, I used emacs 29.4 from Debian when I tested. If this 
feature has changed in emacs 30, then I would not have seen it yet (I am 
not tracking emacs/eglot development a lot).


I am working on a language server for Debian packaging (called 
`debputy`). The Debian packaging files consists of several different 
file formats with cross references between the formats. As a 
consequence, I built my language server to be a "polyglot" (multi-language).

While testing with eglot, I noticed that my language server was not 
informed of all changes. As far as I can see, eglot spawns a language 
server per file format (major mode) and then only informs the language 
server of events (didOpen/didChange) for that major mode. This happens 
even through it is exactly the same command + args for both major modes.

The next result is that my language server when used via emacs + eglot, 
requires the user to save a file before the language server can "see" 
the effect when you are working in a different file.

I was a bit in doubt whether the spec accounted for polyglot language 
servers, so I asked in the LSP github for clarification. They made the 
argument that a language server should be able to see events for other 
file formats and suggested that I contacted you (the eglot maintainers) 
about this 
(https://github.com/microsoft/language-server-protocol/issues/1964). 
They acknowledged this was implicit and then listed the two key features 
they saw as supporting this implicit requirement (both of them boils 
down to DocumentSelector as I read it).

I tried a static registration with a DocumentSelector on `**/debian/*` 
(I think it was hover docs, though it might have been completion), but 
my debugging suggested that my instances did not get didOpen/didChange 
events "across" the file formats even with this registration.

Can we work towards a solution where I can ask eglot to provide 
didOpen/didChange events across formats? :)

Best regards,
Niels





             reply	other threads:[~2024-07-12 11:33 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-12 11:33 Niels Thykier [this message]
2024-07-13  6:15 ` bug#72088: eglot: Segregates language servers in a way that hampers polyglot language servers 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
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=6e65694c-88d6-4c54-93a8-2ffb843ce6d0@thykier.net \
    --to=niels@thykier.net \
    --cc=72088@debbugs.gnu.org \
    /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).