Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP customize eglot-server-programs #224

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ for the language you're using. Otherwise, it prompts you to enter one.
* Dart's [dart_language_server][dart_language_server]

I'll add to this list as I test more servers. In the meantime you can
customize `eglot-server-programs`:
customize `eglot-server-programs`: either
`M-x customize-variable RET eglot-server-programs RET` or

```lisp
(add-to-list 'eglot-server-programs '(foo-mode . ("foo-language-server" "--args")))
Expand Down Expand Up @@ -152,6 +153,8 @@ Here's a quick summary of the customization options. In Eglot's
customization group (`M-x customize-group`) there is more
documentation on what these do.

- `eglot-server-programs`: as described [above](#connecting);

- `eglot-autoreconnect`: Control ability to reconnect automatically to
the LSP server;

Expand All @@ -175,8 +178,6 @@ documentation on what these do.
There are a couple more variables that you can customize via Emacs
lisp:

- `eglot-server-programs`: as described [above](#connecting);

- `eglot-strict-mode`: Set to `nil` by default, meaning Eglot is
generally lenient about non-conforming servers. Set this to
`(disallow-non-standard-keys enforce-required-keys)` when debugging
Expand Down
40 changes: 38 additions & 2 deletions eglot.el
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,30 @@
:prefix "eglot-"
:group 'applications)

(defvar eglot-server-programs '((rust-mode . (eglot-rls "rls"))
(defconst eglot-server-programs-contact
`((cons :tag "Standard I/O"
(string :tag "Program")
(repeat :tag "Arguments" string))
(list :tag "TCP Connection"
(string :tag "Host"
:value "localhost")
(number :tag "TCP Port"
:value 0)
(plist :tag "TCP Parameters"
:inline t
:key-type (symbol :tag "Keyword")))
(cons :tag "TCP Auto-Launch"
(string :tag "Program")
(list (repeat :tag "Arguments"
:inline t
string)
(const :autoport)
(repeat :tag "More"
:inline t
string))))
"Partial list of common customization types for `eglot-server-programs'.")

(defcustom eglot-server-programs '((rust-mode . (eglot-rls "rls"))
(python-mode . ("pyls"))
((js-mode
typescript-mode)
Expand Down Expand Up @@ -139,7 +162,20 @@ of those modes. CONTACT can be:
the call is interactive, the function can ask the user for
hints on finding the required programs, etc. Otherwise, it
should not ask the user for any input, and return nil or signal
an error if it can't produce a valid CONTACT.")
an error if it can't produce a valid CONTACT."
:type `(alist :key-type (choice :tag "Major Modes"
(symbol :value major-mode)
(repeat (symbol :value major-mode)))
:value-type (choice :tag "Contact"
,@eglot-server-programs-contact
(cons :tag "Experimental LSP"
(symbol :tag "Class Name"
:value eglot-lsp-server-subclass)
(choice :tag "Initialization"
(plist :tag "Class Initializer"
:key-type (symbol :tag "Keyword"))
,@eglot-server-programs-contact))
(function :tag "Contact Function"))))

(defface eglot-mode-line
'((t (:inherit font-lock-constant-face :weight bold)))
Expand Down