GNU bug report logs -
#76423
Major-mode provided LSP server for Eglot
Previous Next
Full log
View this message in rfc822 format
Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of
text editors" <bug-gnu-emacs <at> gnu.org> writes:
> Eglot should make it easier for major modes to suggest which LSP
> server to use.
> 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))))
Wouldn't the patch make harder for the users to customize Eglot to use
their preferred LSP server instead of the server suggested by the major
mode?
Thanks,
Felicián
>
> - Stefan
>
>
> diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el
> index bd28174e7da..3aff922be1d 100644
> --- a/lisp/progmodes/eglot.el
> +++ b/lisp/progmodes/eglot.el
> @@ -235,6 +235,10 @@ eglot-alternatives
> when probe return (cons probe args)
> finally (funcall err)))))))
>
> +(defvar-local eglot-server-program nil
> + "Description of the server to use.
> +Follows the same syntax as any element of `eglot-server-programs', ")
> +
> (defvar eglot-server-programs
> ;; FIXME: Maybe this info should be distributed into the major modes
> ;; themselves where they could set a buffer-local `eglot-server-program'
> @@ -354,7 +358,7 @@ eglot-server-programs
>
> * In the most common case, a symbol such as `c-mode';
>
> -* A list (MAJOR-MODE-SYMBOL :LANGUAGE-ID ID) where
> +* A list (MAJOR-MODE-SYMBOL :language-id ID) where
> MAJOR-MODE-SYMBOL is the aforementioned symbol and ID is a
> string identifying the language to the server;
>
> @@ -1331,7 +1335,9 @@ eglot--lookup-mode
> (replace-regexp-in-string
> "\\(?:-ts\\)?-mode$" ""
> (symbol-name sym))))))
> - for (modes . contact) in eglot-server-programs
> + for (modes . contact) in (if (null eglot-server-program)
> + eglot-server-programs
> + (cons eglot-server-program eglot-server-programs))
> for llists = (mapcar #'eglot--ensure-list
> (if (or (symbolp modes) (keywordp (cadr modes)))
> (list modes) modes))
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.