diff --git a/README.md b/README.md index 96ca66e9..1ef33e91 100644 --- a/README.md +++ b/README.md @@ -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"))) @@ -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; @@ -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 diff --git a/eglot.el b/eglot.el index ef0cb083..747daf10 100644 --- a/eglot.el +++ b/eglot.el @@ -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) @@ -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)))