Skip to content

Commit

Permalink
Close joaotavora/eglot#39: Handle experimental/unknown server methods…
Browse files Browse the repository at this point in the history
… gracefully

* eglot.el (eglot-handle-notification t t, eglot-handle-request t
t): Add default handlers for unknown methods.
(eglot-handle-notification $cquery/progress)
(eglot-handle-notification $cquery/setInactiveRegions)
(eglot-handle-notification $cquery/publishSemanticHighlighting):
Remove these no-ops.
  • Loading branch information
joaotavora committed Jul 11, 2018
1 parent cf9f52d commit ca8056f
Showing 1 changed file with 10 additions and 15 deletions.
25 changes: 10 additions & 15 deletions eglot.el
Original file line number Diff line number Diff line change
Expand Up @@ -856,6 +856,16 @@ Uses THING, FACE, DEFS and PREPEND."

;;; Protocol implementation (Requests, notifications, etc)
;;;
(cl-defmethod eglot-handle-notification
(_server method &key)
"Handle unknown notification"
(eglot--warn "Server sent unknown notification method `%s'" method))

(cl-defmethod eglot-handle-request
(_server method &key)
"Handle unknown request"
(jsonrpc-error "Unknown request method `%s'" method))

(cl-defmethod eglot-handle-notification
(_server (_method (eql window/showMessage)) &key type message)
"Handle notification window/showMessage"
Expand Down Expand Up @@ -1582,21 +1592,6 @@ If SKIP-SIGNATURE, don't try to send textDocument/signatureHelp."
(list :cacheDirectory (file-name-as-directory cache)
:progressReportFrequencyMs -1)))

(cl-defmethod eglot-handle-notification
((_server eglot-cquery) (_method (eql $cquery/progress))
&rest counts &key _activeThreads &allow-other-keys)
"No-op for noisy $cquery/progress extension")

(cl-defmethod eglot-handle-notification
((_server eglot-cquery) (_method (eql $cquery/setInactiveRegions))
&key _uri _inactiveRegions &allow-other-keys)
"No-op for unsupported $cquery/setInactiveRegions extension")

(cl-defmethod eglot-handle-notification
((_server eglot-cquery) (_method (eql $cquery/publishSemanticHighlighting))
&key _uri _symbols &allow-other-keys)
"No-op for unsupported $cquery/publishSemanticHighlighting extension")


;; FIXME: A horrible hack of Flymake's insufficient API that must go
;; into Emacs master, or better, 26.2
Expand Down

0 comments on commit ca8056f

Please sign in to comment.