emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Making `eglot-server-programs' a custom variable?


From: Tim Cross
Subject: Re: Making `eglot-server-programs' a custom variable?
Date: Thu, 10 Nov 2022 18:56:01 +1100
User-agent: mu4e 1.9.1; emacs 29.0.50

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Arash Esbati <arash@gnu.org>
>> Date: Wed, 09 Nov 2022 21:25:53 +0100
>> 
>> I tried eglot only once and I had to add a lsp-server to
>> `eglot-server-programs'.  From this experience, is there a plan to make
>> this a custom variable?  If not, I suggest to change the example in
>> eglot manual from
>> 
>>   (add-to-list 'eglot-server-programs
>>                '(foo-mode . ("fools" "--stdio")))
>> 
>> to
>> 
>>   (with-eval-after-load 'eglot
>>     (add-to-list 'eglot-server-programs
>>                  '(foo-mode . ("fools" "--stdio"))))
>> 
>> for those who will copy&paste this into their init files and then wonder
>> why it throws an error.
>
> The intent is for this variable to include enough servers to make it
> unnecessary to add to the list.  With that in mind, I wouldn't
> complicate the manual by making sure this is copy/paste-able.
>
> Is the LSP server you needed to add still missing from the database
> currently on master?  If so, please suggest the addition(s).

I'm not sure that intent will hold. It has the underlying assumption
there is a definitive language server for each language. There are
multiple servers for many languages and individual
preferences/requirements can differ.

The first thing I had to do in order to use eglot was modify this
variable to add my preferred Javascript server. From an end user
perspective, this was harder to do than making the same change with
lsp-mode. For reference, here is what I ended up doing to get it working

  (defclass eglot-deno (eglot-lsp-server) ()
     :documentation "A custom class for deno lsp.")
   (cl-defmethod eglot-initialization-options ((server eglot-deno))
     "Passes through required deno initialization options"
     (list :enable t
           :lint t))
  (add-to-list 'eglot-server-programs '((js-mode typescript-mode) . (eglot-deno 
"deno" "lsp")))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]