branch: externals/eglot
commit 5d88eeddaaba98bdc90e661a0bab71c8c12a84bb
Author: João Távora <[email protected]>
Commit: João Távora <[email protected]>
Close #39: Handle experimental/unknown server methods 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.
---
eglot.el | 25 ++++++++++---------------
1 file changed, 10 insertions(+), 15 deletions(-)
diff --git a/eglot.el b/eglot.el
index 8d61bbb..77f8260 100644
--- a/eglot.el
+++ b/eglot.el
@@ -857,6 +857,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"
(eglot--message (propertize "Server reports (type=%s): %s"
@@ -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