Skip to content

Commit 281fa83

Browse files
committed
update eglot-server-programs customization widget
add inline widget documentation define constants for widget formats revise :type for TCP Connection rename TCP Auto-connect to TCP Auto-Launch
1 parent ee6e3bc commit 281fa83

File tree

1 file changed

+49
-18
lines changed

1 file changed

+49
-18
lines changed

eglot.el

+49-18
Original file line numberDiff line numberDiff line change
@@ -78,23 +78,37 @@
7878
:prefix "eglot-"
7979
:group 'applications)
8080

81+
(defconst eglot-custom-format-doc "%t: %v%h"
82+
"Custom type format for widget with expandable inline documentation.")
83+
84+
(defconst eglot-custom-format-button-doc "%[%t%] %v%h"
85+
"Custom type format for button widget with expandable inline documentation.")
86+
8187
(defconst eglot-server-programs-contact
82-
'((cons :tag "Standard I/O"
88+
`((cons :format ,eglot-custom-format-doc
89+
:tag "Standard I/O"
90+
:doc "PROGRAM is called with ARGS and is expected to serve LSP requests over the standard input/output channels."
8391
(string :tag "Program")
8492
(repeat :tag "Arguments" string))
85-
(list :tag "TCP Connection"
86-
(string :tag "Host")
87-
(number :tag "Port")
88-
(list :tag "TCP Arguments"
89-
:inline t
90-
string
91-
(choice (const nil)
92-
string)
93-
string
94-
(choice string
95-
number)
96-
(plist :key-type symbol)))
97-
(cons :tag "TCP Auto-connect"
93+
(list :format ,eglot-custom-format-doc
94+
:tag "TCP Connection"
95+
:doc "For connecting to a server via TCP."
96+
(string :format ,eglot-custom-format-doc
97+
:tag "Host"
98+
:doc "Name or IP address.")
99+
(number :tag "TCP Port")
100+
(plist :format ,eglot-custom-format-doc
101+
:tag "TCP Parameters"
102+
:doc "Passed to `open-network-stream' for upgrading the connection with encryption or other capabilities.
103+
Sequence of keywords and values: consult `open-network-stream' PARAMETERS documentation."
104+
:key-type (symbol :tag "Keyword")))
105+
(cons :format ,eglot-custom-format-doc
106+
:tag "TCP Auto-Launch"
107+
:doc "A combination of TCP Connection and program launch.
108+
First, an attempt is made to find an available server port, then
109+
PROGRAM is launched with ARGS; the `:autoport' keyword substituted for
110+
that number; and MOREARGS. Eglot then attempts to to establish a TCP
111+
connection to that port number on the localhost."
98112
(string :tag "Program")
99113
(list (repeat :tag "Arguments"
100114
:inline t
@@ -173,12 +187,29 @@ of those modes. CONTACT can be:
173187
:value-type (choice :tag "Contact"
174188
,@eglot-server-programs-contact
175189
(cons :tag "Experimental LSP"
176-
(symbol :tag "Class Name")
177-
(choice :tag "Initialization"
178-
(plist :tag "Class Initializer"
190+
(symbol :format ,eglot-custom-format-doc
191+
:tag "Class Name"
192+
:doc "A symbol designating a subclass of `eglot-lsp-server', for representing experimental LSP servers.")
193+
(choice :format ,eglot-custom-format-button-doc
194+
:tag "Initialization"
195+
:doc "A plist of CLASS-NAME initialization parameters, or a CONTACT form, which is converted to a suitable :PROCESS initialization parameter for CLASS-NAME.
196+
The class `eglot-lsp-server' descends `jsonrpc-process-connection',
197+
which you should see for the semantics of the mandatory :PROCESS
198+
argument."
199+
(plist :format ,eglot-custom-format-doc
200+
:tag "Class Initializer"
201+
:doc "A keyword-value plist used to initialize CLASS-NAME."
179202
:key-type symbol)
180203
,@eglot-server-programs-contact))
181-
(function :tag "Contact Generator"))))
204+
(function :format ,eglot-custom-format-doc
205+
:tag "Contact Generator"
206+
:doc "A function of a single argument producing any of the other values for CONTACT.
207+
The argument's value is non-nil if the connection was requested
208+
interactively (e.g. from the `eglot' command), and nil if it wasn't
209+
(e.g. from `eglot-ensure'). If the call is interactive, the function
210+
can ask the user for hints on finding the required programs, etc.
211+
Otherwise, it should not ask the user for any input, and return nil or
212+
signal an error if it can't produce a valid CONTACT."))))
182213

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

0 commit comments

Comments
 (0)