unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "João Távora" <joaotavora@gmail.com>
To: Felician Nemeth <felician.nemeth@gmail.com>
Cc: 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 16:41:52 +0100	[thread overview]
Message-ID: <875yjlxkqn.fsf@gmail.com> (raw)
In-Reply-To: <87mtcxgrto.fsf@betli.tmit.bme.hu> (Felician Nemeth's message of "Mon, 25 Jul 2022 17:00:51 +0200")

Felician Nemeth <felician.nemeth@gmail.com> writes:

>>> I don't think the current API is good enough for that.  See
>>> https://github.com/joaotavora/eglot/discussions/802#discussioncomment-2171239
>>
>> Really depends on what you consider "that" to be.
>
> To implement non-standard LSP features, which lots of servers propose.

Yes, that's one of the possibilities.  Another possibility is offering a
different, perhaps richer interface to programming facilities specific
to the major mode which may or may not rely on Eglot's LSP.  For
example, if LSP isn't available, or isn't the best choice for a
particular feature (say completion, or definition-finding) this
interface might delegate to some other tool, to CEDET, etc.

>> [...] Also, once Eglot is in core, I won't be only person deciding.
>
> (I welcome Eglot's inclusion in the core and appreciate your work.  I
> hope that's clear.)

And I hope it's clear that I immensely appreciate your work and your
review efforts in Eglot.  Eglot doesn't have many contributors who
understand the code base well (and bringing it to core is also an effort
to change that).

>>> More importantly, there are multiple language server implementations for
>>> some languages (python, c) with different quirks or non-standard
>>> extensions to the LSP protocol.  How do you imagine a major-mode would
>>> support these?
>>
>> They can adds methods to the generic function eglot-handle-request (and
>> a handful others), set values of Eglot in their major-mode
>> initialization code, bind keys to `eglot-*` interactive commands, make
>> compound commands from those commands, etc.
>
> OK.  This is somewhat similar to the case when a major mode provides an
> xref or a flymake backend.
>
> But I think sometimes the reverse approach is more desirable.  Let's
> take a not so hypothetical example and say c++-mode wants to provide a
> type-hierarchy browser.  It's better to write a generic, language
> agnostic hierarchy browser (maybe CEDET even has one), and extend Eglot
> with a hierarchy browser backend similarly to its xref backend.  The
> hierarchy browser then can have a tree-sitter backend as well.

Yes, I fully agree.

>> While they _can_, but that doesn't mean they _must_ or even _should_.
>> In fact, LSP's whole idea, which is surprisingly forgotten so often, is
>> that server and editor need to know very little about each other to be
>> able to cooperate.  By and large this idea works very very well. 
>
> I agree, but non-standard extensions exist for a reason.

Yup, it's normal.  You see the same in programming extensions that
appear in specific compilers first.  Some of then make it to the
standards, some don't.  Sometimes they make it in largely unchanged and
adapting clients is easy, sometimes not so much.  Standardization is
hard.

> Almost all servers have a VS-Code specific part that contains at least a
> list of configuration variables that other clients cannot handle
> automatically.  BTW, if Eglot knew about these configuration variables,
> could `customize-group` somehow save the settings into a .dir-locals.el
> file?

Very interesting.  Yes, I think this is a great idea to allow the user
to configure server-specific things easily and automatically save it
.dir-locals.el.  People tend to struggle with that, and it's 

The question is how.  Not sure if variables is the way to go.  It
_could_ be (but it could also be some plist/alist).  But let's say it's
variables, i.e. symbols holding values.  Then these symbols belong to
the major mode, not to server-agnostic eglot.el.  Then maybe each such
variable could have a symbol property 'eglot--server-specific-section'
and 'eglot--server-specific-name'.  Then there could indeed be a command
M-x eglot-save-server-specific-variables that creates/updates
.dir-locals.el for the given project.

Maybe custom.el machinery could call that command automatically. But for
which projects?  All of them?  The "current" one?  We don't have
project-specific custom.el

And also when using variables I always think its nice not to force
custom.el the user.  I know others like me prefer to set things from
.emacs.  So it should work without it.

>> Eglot works with tens of servers and hasn't got a line of server
>> specific code, except for eglot-server-programs invocations.  There
>> are exceptions, and not everyone has the same luck, but I've been
>> using C++ clangd and C# omnisharp quite a lot lately and I have 0
>> lines of server specific config.
>
> Even clangd has a moderately long list of extensions:
> https://clangd.llvm.org/extensions.html#type-hierarchy
> Sure, clangd is usable without them, but some of the extensions might
> make someone's life easier, for example, by providing a type hierarchy
> browser.

Writing more C++ lately I do feel this need yes.  I was looking at
tree-widget.el the other day, but didn't make much progress.  I fully
agree to what you we should make some backend-agnostic frontend first
and then plug it into eglot.el or eglot-x.el

>> [...] So there isn't any problem/drama here.
> I don't want to start one either, but it's a good time to think once
> more about Eglot's relations with other packages.

Aye, and that's always the thing with Eglot: it's at the intersection of
many things.

João



  reply	other threads:[~2022-07-25 15:41 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 [this message]
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
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=875yjlxkqn.fsf@gmail.com \
    --to=joaotavora@gmail.com \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=felician.nemeth@gmail.com \
    --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).