Eglot: cleanup whitespace and indentation
Co-authored-by: João Távora <joaotavora@gmail.com> * lisp/progmodes/eglot: Misc whitespace fixes.
This commit is contained in:
parent
465a9e78b9
commit
0cfeb1c2bc
1 changed files with 42 additions and 42 deletions
|
@ -541,7 +541,7 @@ on unknown notifications and errors on unknown requests."))
|
||||||
for type = (or (cdr (assoc k types)) t) ;; FIXME: enforce nil type?
|
for type = (or (cdr (assoc k types)) t) ;; FIXME: enforce nil type?
|
||||||
unless (cl-typep v type)
|
unless (cl-typep v type)
|
||||||
do (eglot--error "A `%s' must have a %s as %s, but has %s"
|
do (eglot--error "A `%s' must have a %s as %s, but has %s"
|
||||||
interface-name )))
|
interface-name)))
|
||||||
t))
|
t))
|
||||||
|
|
||||||
(eval-and-compile
|
(eval-and-compile
|
||||||
|
@ -1126,11 +1126,11 @@ INTERACTIVE is t if called interactively."
|
||||||
(let ((buffer (current-buffer)))
|
(let ((buffer (current-buffer)))
|
||||||
(cl-labels
|
(cl-labels
|
||||||
((maybe-connect
|
((maybe-connect
|
||||||
()
|
()
|
||||||
(remove-hook 'post-command-hook #'maybe-connect nil)
|
(remove-hook 'post-command-hook #'maybe-connect nil)
|
||||||
(eglot--when-live-buffer buffer
|
(eglot--when-live-buffer buffer
|
||||||
(unless eglot--managed-mode
|
(unless eglot--managed-mode
|
||||||
(apply #'eglot--connect (eglot--guess-contact))))))
|
(apply #'eglot--connect (eglot--guess-contact))))))
|
||||||
(when buffer-file-name
|
(when buffer-file-name
|
||||||
(add-hook 'post-command-hook #'maybe-connect 'append nil)))))
|
(add-hook 'post-command-hook #'maybe-connect 'append nil)))))
|
||||||
|
|
||||||
|
@ -1182,7 +1182,7 @@ Each function is passed the server as an argument")
|
||||||
(list "sh" "-c"
|
(list "sh" "-c"
|
||||||
(string-join (cons "stty raw > /dev/null;"
|
(string-join (cons "stty raw > /dev/null;"
|
||||||
(mapcar #'shell-quote-argument contact))
|
(mapcar #'shell-quote-argument contact))
|
||||||
" "))
|
" "))
|
||||||
contact))
|
contact))
|
||||||
|
|
||||||
(defvar-local eglot--cached-server nil
|
(defvar-local eglot--cached-server nil
|
||||||
|
@ -1236,7 +1236,7 @@ This docstring appeases checkdoc, that's all."
|
||||||
,@more-initargs)))))
|
,@more-initargs)))))
|
||||||
(spread (lambda (fn) (lambda (server method params)
|
(spread (lambda (fn) (lambda (server method params)
|
||||||
(let ((eglot--cached-server server))
|
(let ((eglot--cached-server server))
|
||||||
(apply fn server method (append params nil))))))
|
(apply fn server method (append params nil))))))
|
||||||
(server
|
(server
|
||||||
(apply
|
(apply
|
||||||
#'make-instance class
|
#'make-instance class
|
||||||
|
@ -1570,7 +1570,7 @@ Doubles as an indicator of snippet support."
|
||||||
(setq-local markdown-fontify-code-blocks-natively t)
|
(setq-local markdown-fontify-code-blocks-natively t)
|
||||||
(insert string)
|
(insert string)
|
||||||
(let ((inhibit-message t)
|
(let ((inhibit-message t)
|
||||||
(message-log-max nil))
|
(message-log-max nil))
|
||||||
(ignore-errors (delay-mode-hooks (funcall mode))))
|
(ignore-errors (delay-mode-hooks (funcall mode))))
|
||||||
(font-lock-ensure)
|
(font-lock-ensure)
|
||||||
(string-trim (buffer-string)))))
|
(string-trim (buffer-string)))))
|
||||||
|
@ -1855,8 +1855,8 @@ If it is activated, also signal textDocument/didOpen."
|
||||||
(force-mode-line-update t))))))
|
(force-mode-line-update t))))))
|
||||||
|
|
||||||
(defun eglot-manual () "Open documentation."
|
(defun eglot-manual () "Open documentation."
|
||||||
(declare (obsolete info "29.1"))
|
(declare (obsolete info "29.1"))
|
||||||
(interactive) (info "(eglot)"))
|
(interactive) (info "(eglot)"))
|
||||||
|
|
||||||
(easy-menu-define eglot-menu nil "Eglot"
|
(easy-menu-define eglot-menu nil "Eglot"
|
||||||
`("Eglot"
|
`("Eglot"
|
||||||
|
@ -1960,17 +1960,17 @@ Uses THING, FACE, DEFS and PREPEND."
|
||||||
'keymap (let ((map (make-sparse-keymap)))
|
'keymap (let ((map (make-sparse-keymap)))
|
||||||
(define-key map [mode-line down-mouse-1] eglot-server-menu)
|
(define-key map [mode-line down-mouse-1] eglot-server-menu)
|
||||||
map))
|
map))
|
||||||
,@(when last-error
|
,@(when last-error
|
||||||
`("/" ,(eglot--mode-line-props
|
`("/" ,(eglot--mode-line-props
|
||||||
"error" 'compilation-mode-line-fail
|
"error" 'compilation-mode-line-fail
|
||||||
'((mouse-3 eglot-clear-status "Clear this status"))
|
'((mouse-3 eglot-clear-status "Clear this status"))
|
||||||
(format "An error occurred: %s\n" (plist-get last-error
|
(format "An error occurred: %s\n" (plist-get last-error
|
||||||
:message)))))
|
:message)))))
|
||||||
,@(when (cl-plusp pending)
|
,@(when (cl-plusp pending)
|
||||||
`("/" ,(eglot--mode-line-props
|
`("/" ,(eglot--mode-line-props
|
||||||
(format "%d" pending) 'warning
|
(format "%d" pending) 'warning
|
||||||
'((mouse-3 eglot-forget-pending-continuations
|
'((mouse-3 eglot-forget-pending-continuations
|
||||||
"Forget pending continuations"))
|
"Forget pending continuations"))
|
||||||
"Number of outgoing, \
|
"Number of outgoing, \
|
||||||
still unanswered LSP requests to the server\n"))))))))
|
still unanswered LSP requests to the server\n"))))))))
|
||||||
|
|
||||||
|
@ -1988,13 +1988,13 @@ still unanswered LSP requests to the server\n"))))))))
|
||||||
(defalias 'eglot--diag-data 'flymake-diagnostic-data)
|
(defalias 'eglot--diag-data 'flymake-diagnostic-data)
|
||||||
|
|
||||||
(cl-loop for i from 1
|
(cl-loop for i from 1
|
||||||
for type in '(eglot-note eglot-warning eglot-error )
|
for type in '(eglot-note eglot-warning eglot-error)
|
||||||
do (put type 'flymake-overlay-control
|
do (put type 'flymake-overlay-control
|
||||||
`((mouse-face . highlight)
|
`((mouse-face . highlight)
|
||||||
(priority . ,(+ 50 i))
|
(priority . ,(+ 50 i))
|
||||||
(keymap . ,(let ((map (make-sparse-keymap)))
|
(keymap . ,(let ((map (make-sparse-keymap)))
|
||||||
(define-key map [mouse-1]
|
(define-key map [mouse-1]
|
||||||
(eglot--mouse-call 'eglot-code-actions))
|
(eglot--mouse-call 'eglot-code-actions))
|
||||||
map)))))
|
map)))))
|
||||||
|
|
||||||
|
|
||||||
|
@ -2174,7 +2174,7 @@ THINGS are either registrations or unregisterations (sic)."
|
||||||
(append
|
(append
|
||||||
(eglot--VersionedTextDocumentIdentifier)
|
(eglot--VersionedTextDocumentIdentifier)
|
||||||
(list :languageId
|
(list :languageId
|
||||||
(eglot--language-id (eglot--current-server-or-lose))
|
(eglot--language-id (eglot--current-server-or-lose))
|
||||||
:text
|
:text
|
||||||
(eglot--widening
|
(eglot--widening
|
||||||
(buffer-substring-no-properties (point-min) (point-max))))))
|
(buffer-substring-no-properties (point-min) (point-max))))))
|
||||||
|
@ -2636,7 +2636,7 @@ If BUFFER, switch to it before."
|
||||||
uri range))))))
|
uri range))))))
|
||||||
(if (vectorp response) response (and response (list response)))))))
|
(if (vectorp response) response (and response (list response)))))))
|
||||||
|
|
||||||
(cl-defun eglot--lsp-xref-helper (method &key extra-params capability )
|
(cl-defun eglot--lsp-xref-helper (method &key extra-params capability)
|
||||||
"Helper for `eglot-find-declaration' & friends."
|
"Helper for `eglot-find-declaration' & friends."
|
||||||
(let ((eglot--lsp-xref-refs (eglot--lsp-xrefs-for-method
|
(let ((eglot--lsp-xref-refs (eglot--lsp-xrefs-for-method
|
||||||
method
|
method
|
||||||
|
@ -2668,7 +2668,7 @@ If BUFFER, switch to it before."
|
||||||
(get-text-property 0 'eglot--lsp-workspaceSymbol probe)
|
(get-text-property 0 'eglot--lsp-workspaceSymbol probe)
|
||||||
(eglot--dbind ((Location) uri range) location
|
(eglot--dbind ((Location) uri range) location
|
||||||
(list (eglot--xref-make-match name uri range))))
|
(list (eglot--xref-make-match name uri range))))
|
||||||
(eglot--lsp-xrefs-for-method :textDocument/definition))))
|
(eglot--lsp-xrefs-for-method :textDocument/definition))))
|
||||||
|
|
||||||
(cl-defmethod xref-backend-references ((_backend (eql eglot)) _identifier)
|
(cl-defmethod xref-backend-references ((_backend (eql eglot)) _identifier)
|
||||||
(or
|
(or
|
||||||
|
@ -2707,7 +2707,7 @@ for which LSP on-type-formatting should be requested."
|
||||||
`(:textDocument/onTypeFormatting
|
`(:textDocument/onTypeFormatting
|
||||||
:documentOnTypeFormattingProvider
|
:documentOnTypeFormattingProvider
|
||||||
,`(:position ,(eglot--pos-to-lsp-position beg)
|
,`(:position ,(eglot--pos-to-lsp-position beg)
|
||||||
:ch ,(string on-type-format))))
|
:ch ,(string on-type-format))))
|
||||||
((and beg end)
|
((and beg end)
|
||||||
`(:textDocument/rangeFormatting
|
`(:textDocument/rangeFormatting
|
||||||
:documentRangeFormattingProvider
|
:documentRangeFormattingProvider
|
||||||
|
@ -3280,24 +3280,24 @@ at point. With prefix argument, prompt for ACTION-KIND."
|
||||||
(eglot--project server))))))
|
(eglot--project server))))))
|
||||||
(cl-labels
|
(cl-labels
|
||||||
((handle-event
|
((handle-event
|
||||||
(event)
|
(event)
|
||||||
(pcase-let* ((`(,desc ,action ,file ,file1) event)
|
(pcase-let* ((`(,desc ,action ,file ,file1) event)
|
||||||
(action-type (cl-case action
|
(action-type (cl-case action
|
||||||
(created 1) (changed 2) (deleted 3)))
|
(created 1) (changed 2) (deleted 3)))
|
||||||
(action-bit (when action-type
|
(action-bit (when action-type
|
||||||
(ash 1 (1- action-type)))))
|
(ash 1 (1- action-type)))))
|
||||||
(cond
|
(cond
|
||||||
((and (memq action '(created changed deleted))
|
((and (memq action '(created changed deleted))
|
||||||
(cl-loop for (glob . kind-bitmask) in globs
|
(cl-loop for (glob . kind-bitmask) in globs
|
||||||
thereis (and (> (logand kind-bitmask action-bit) 0)
|
thereis (and (> (logand kind-bitmask action-bit) 0)
|
||||||
(funcall glob file))))
|
(funcall glob file))))
|
||||||
(jsonrpc-notify
|
(jsonrpc-notify
|
||||||
server :workspace/didChangeWatchedFiles
|
server :workspace/didChangeWatchedFiles
|
||||||
`(:changes ,(vector `(:uri ,(eglot--path-to-uri file)
|
`(:changes ,(vector `(:uri ,(eglot--path-to-uri file)
|
||||||
:type ,action-type)))))
|
:type ,action-type)))))
|
||||||
((eq action 'renamed)
|
((eq action 'renamed)
|
||||||
(handle-event `(,desc 'deleted ,file))
|
(handle-event `(,desc 'deleted ,file))
|
||||||
(handle-event `(,desc 'created ,file1)))))))
|
(handle-event `(,desc 'created ,file1)))))))
|
||||||
(unwind-protect
|
(unwind-protect
|
||||||
(progn
|
(progn
|
||||||
(dolist (dir dirs-to-watch)
|
(dolist (dir dirs-to-watch)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue