GNU bug report logs -
#76423
Major-mode provided LSP server for Eglot
Previous Next
Full log
View this message in rfc822 format
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:
Hi Stefan,
> The patch below would let this major modes do it with a simple:
>
> (setq-local eglot-server-programs
> `(bicep-ts-mode . ("dotnet"
> ,(bicep-langserver-path))))
You mean eglot-server-program, singular (that's what your patch proposes)
Anyway, your patch is more or less what I had in mind altough:
* The name should probably be something less confusable with
e-s-programs, like eglot-suggested-servers or eglot-preferred-servers
(note that it can still be "servers!" unless we purposedly cap that
ability, which we maybe should).
* It's a bit silly to repeat the major-mode symbol in it. So the
setting in the major-mode function should be something like
(setq eglot-suggested-servers '("dotnet" ,(bicep-langserver-path)))
As to the precedence logic which you all discussed in the following
emails, I think it is indeed a problem. But I don't see a problem in
prioritizing eglot-suggested-servers.
* The user can always nullify it with a
(add-hook 'foo-mode-hook
(lambda () (setq eglot-suggested-server nil)))
I don't see this as a hindrance and I don't want to add much extra
logic to Eglot to manage this for users afraid of add-hook. The Eglot
manual already uses these add-hook snippets and as long as people know
to copy-paste. If people want to the use-package macro magic to keep
themselves ignorant of how Emacs works, I think that's a mistake, but
this shouldn't stop them.
* Nevertheless it should be possible to add some logic to eglot.el to
discover if the e-s-programs variable has been modified.
* It's important to note that this effort by itself won't bring many
advantages until major-modes can somehow know during their normal
working that eglot-suggested-servers hasn't been touched and that a
particularly friendly server has effectively been started (either by
M-x eglot or by the major mode itself, with appropriate care). Then,
foo-mode will be able to provide specific `M-x foo-thingamabob`
commands that make use of an LSP connection, much like python.el or
ruby-mode.el provide commands to send a region to the interpreter,
etc.
* I'm against adding eglot-server-user-programs or somesuch as someone
is proposing. I only want to add a new variable to be settable by the
major mode. And ideally it should come with examples of major-mode
patches with such added functionality for the "friendly server", else
what is the point of having the major mode even set it?
João
PS: something that I didn't mention in my recent reply to a patch about
this in the mailing list by Philip Kaludercic (posted to emacs-devel I
think) is that none of these efforts shall break eglot.el from being
compiled and loaded in older Emacsen (his patch did that).
This bug report was last modified 113 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.