From 46de6683a7e827b3fb3d273605b3461075038c6f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jo=C3=A3o=20T=C3=A1vora?= Date: Wed, 11 Jul 2018 09:46:14 +0100 Subject: [PATCH] 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. GitHub-reference: close https://github.com/joaotavora/eglot/issues/39 --- lisp/progmodes/eglot.el | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index 8d61bbbce37..77f8260b229 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el @@ -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" @@ -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 -- 2.39.2