unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Niels Thykier <niels@thykier.net>
To: "Eli Zaretskii" <eliz@gnu.org>, "João Távora" <joaotavora@gmail.com>
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 09:31:41 +0200	[thread overview]
Message-ID: <fa0c1630-dc7c-45a8-8fa8-a8c8058814eb@thykier.net> (raw)
In-Reply-To: <86cyngk2qm.fsf@gnu.org>

Eli Zaretskii:
>> From: João Távora <joaotavora@gmail.com>
>> Date: Sat, 13 Jul 2024 17:29:04 +0100
>> Cc: Niels Thykier <niels@thykier.net>, 72088@debbugs.gnu.org
>>
>> Major modes in eglot-server-programs don't work? What was attempted? I couldn't understand. Look at
>> existing examples, like C/C++ file types being handled by the same server, and others.
> 
> AFAIU, the OP tried to use the same LSP server for several languages,
> or something like that.

Correct, I am using the same LSP server for several languages (major-modes).

I observe that eglot spawns an instance *per* major mode even though I 
use exactly the same definition in eglot-server-programs. Additionally, 
each instance only receives "didOpen" and "didChange" events for the 
given mode they were spawned for.

 From my PoV, ideally, it would be possible to ask eglot to spawn only 
one instance across all major modes and it would receive "didOpen" and 
"didChange" events for all the modes that it was registered for. Like 
the singleton pattern from programming languages.


Alternatively, I think it would also be possible to have an instance per 
major mode as long as they receive the "didOpen" and "didChange" for all 
relevant modes (that is, eglot sends the same "didOpen"/"didChange" 
event to multiple servers). The downside of the later approach is that 
the same computations happen twice and is sent back to eglot that then 
has deal with the duplication. Notably push diagnostics would then 
happen once per server per major mode.


Note since I am the author of the language server, I am looking for a 
way for eglot manage the life-cycle of the language server. Asking my 
consumers to manually start and stop the language server would make it a 
second-class language server at best.

Best regards,
Niels






  reply	other threads:[~2024-07-14  7:31 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 [this message]
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=fa0c1630-dc7c-45a8-8fa8-a8c8058814eb@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).