unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "João Távora" <joaotavora@gmail.com>
To: "João Távora" <joaotavora@gmail.com>,
	"Po Lu" <luangruo@yahoo.com>,
	"Stefan Monnier" <monnier@iro.umontreal.ca>,
	"Stefan Kangas" <stefan@marxist.se>,
	"Eli Zaretskii" <eliz@gnu.org>, emacs-devel <emacs-devel@gnu.org>
Subject: Re: Eglot to core [Was: rmsbolt.el [Was: Colorful line numbers]]
Date: Mon, 25 Jul 2022 18:05:25 +0100	[thread overview]
Message-ID: <CALDnm502cjESXNkiwoUfOtuLfzH_rEvanpqCdKK+7jQ0zvg+fA@mail.gmail.com> (raw)
In-Reply-To: <87edy9i3aa.fsf@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 4220 bytes --]

On Mon, Jul 25, 2022 at 5:08 PM Max Brieiev <max.brieiev@gmail.com> wrote:

> Conceptually, Eglot matches a single major mode to a specific language
server.

That is true.

> In some cases this is a limitation, because there are servers that are
> supposed to handle the project as a whole.

That is not the principal limitation, however.  It could be in a
specific case but it's not a fundamental one.  The limitation is rather
when multiple servers can operate on the same major mode of the same
project, offering different perspectives on your source code. Like one
language server dedicated to spelling, and the other to language things,
one dedicated to a specific linter, etc...

Often the language server itself aggregates these various perspectives
For example the clangd server offers optional support for the clang-tidy
linter, if it finds it.

But this is not always so and I think that some LSP clients do allow
multiple language servers to manage the same file.  Eglot doesn't.  It
requires significant (but not impossible) work on the base model.  I'm
interested in hearing about a "killer use case" for this, i.e. in
hearing about a case where a user has been forced to choose just one of
twogreat language servers for a given major-mode.

On a tangent: the language server jungle is vast and growing every day.
The single greatest difficulty I have in understanding and addressing
bug reports to Eglot is reproducibility.  It always starts with someone
working on language Foo using some special foo-mode.el and some special
foo-server with some special configuration and asking me to debug a
specific problem.  Installing all these things (language toolchain,
foo-mode and foo-server) on my machine is very time-consuming, not to
mention debugging user's .emacs files.  I just don't have the mental
bandwidth.  It would be great if someone could work on some
"server-replayer" application that reads in Eglot event logs collected
from actual servers or synthesized event logs, so that these
installations aren't necessary.  That would really speed up Eglot
development and bug-hunting.

> This is especially the case in web development. The project may contain
> various content types: javascript, stylesheets, html, xml, json,
> typescript, syntax extensions like jsx, and so on.
>
> This is where it is preferrable to have a single server instance per a
> number of major modes. The server may read project configuration file
> from the project's root directory, or be passed appropriate
> initialization options during server startup.
>
> If major modes were to use Eglot's API in their own ways, wouldn't they
> step on each other toes - e.g. each one passing conflicting
> initialization options to the server?

They surely could, but if there isn't some kind of consensus between the
major modes, it's not too difficult to extract a horizontal *minor* mode
that encompasses these differences.  This is a common, effective Emacs
way of solving this problem.  Then have the minor mode set
eglot-server-programs (or better yet, eglot-server-program) with the
correct invocation.

> Not sure whether Eglot supports this use case, but in the past I wasn't
> able to get it working.

It requires more coding, but it isn't extremely difficult.  Have a look
at the SLY Common Lisp IDE and the sly-mode minor mode in particular.
It turns on in lisp-mode source files, and in special SLY buffers whose
major mode isn't lisp-mode and whose content isn't necessarily Common Lisp
source code.  sly-mode sets and manages buffer-local variables that then
work for all intents are purposes as you describe.

The other difficulty you might face is that even doing the above with
Eglot today will probably result in multiple inferior server processes
being spawned (though now with the "correct" invocation).  That may or
may not be a problem and depends on whether the LS has a distributed
architecture.  If it doesn't, then Eglot also offers the TCP transport
model, where one single server is first started and then each inferior
process is actually a networking connection to that one process with a
single address space.

João

[-- Attachment #2: Type: text/html, Size: 4613 bytes --]

  reply	other threads:[~2022-07-25 17:05 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-22  7:50 Colorful line numbers João Távora
2022-07-22 11:00 ` Eli Zaretskii
2022-07-22 11:29   ` João Távora
2022-07-22 11:42     ` Eli Zaretskii
2022-07-22 12:02       ` João Távora
2022-07-22 13:27         ` Eli Zaretskii
2022-07-22 13:53           ` João Távora
2022-07-22 14:33             ` Eli Zaretskii
2022-07-22 15:10               ` João Távora
2022-07-22 15:38                 ` Eli Zaretskii
2022-07-22 16:30                   ` rmsbolt.el [Was: Colorful line numbers] João Távora
2022-07-22 19:53                     ` Stefan Monnier
2022-07-23  6:13                     ` Eli Zaretskii
2022-07-23  9:35                       ` João Távora
2022-07-23 10:25                         ` Eli Zaretskii
2022-07-23 14:43                           ` Stefan Monnier
2022-07-23 15:52                             ` Eli Zaretskii
2022-07-23 16:31                               ` Stefan Monnier
2022-07-23 17:07                                 ` Colorful line numbers Eli Zaretskii
2022-07-23 18:18                                 ` rmsbolt.el [Was: Colorful line numbers] João Távora
2022-07-23 18:11                           ` João Távora
2022-07-23 14:53                     ` Jay Kamat
2022-07-23 17:25                       ` Stefan Monnier
2022-07-23 17:34                         ` Eglot to core [Was: rmsbolt.el [Was: Colorful line numbers]] João Távora
2022-07-23 17:52                           ` Stefan Monnier
2022-07-24 18:58                             ` João Távora
2022-07-24 19:04                               ` Stefan Monnier
2022-07-25  1:05                               ` Po Lu
2022-07-25  2:45                                 ` Stefan Monnier
2022-07-25  5:55                                   ` Philip Kaludercic
2022-07-25 15:31                                     ` Stefan Monnier
2022-07-25  6:23                                   ` Po Lu
2022-07-25 10:49                                     ` Bozhidar Batsov
2022-07-25 11:01                                     ` João Távora
2022-07-25 11:50                                       ` Felician Nemeth
2022-07-25 12:27                                         ` João Távora
2022-07-25 12:29                                           ` João Távora
2022-07-25 15:00                                           ` Felician Nemeth
2022-07-25 15:41                                             ` João Távora
2022-07-26  8:12                                               ` Felician Nemeth
2022-07-26  8:21                                                 ` João Távora
2022-07-26  8:55                                                   ` Felician Nemeth
2022-07-25 16:07                                       ` Max Brieiev
2022-07-25 17:05                                         ` João Távora [this message]
2022-07-25 15:33                                     ` Stefan Monnier
2022-07-22 12:18 ` Colorful line numbers Dmitry Gutov
2022-07-22 12:38 ` Stefan Monnier
2022-07-22 13:41   ` Dmitry Gutov
2022-07-22 14:01     ` João Távora
2022-07-22 23:32     ` Stefan Monnier
2022-07-23 18:50       ` Dmitry Gutov

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=CALDnm502cjESXNkiwoUfOtuLfzH_rEvanpqCdKK+7jQ0zvg+fA@mail.gmail.com \
    --to=joaotavora@gmail.com \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=luangruo@yahoo.com \
    --cc=monnier@iro.umontreal.ca \
    --cc=stefan@marxist.se \
    /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).