From: João Távora Date: Wed, 11 Jul 2018 08:46:14 +0000 (+0100) Subject: Handle experimental/unknown server methods gracefully X-Git-Tag: emacs-29.0.90~1616^2~524^2~4^2~475 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=46de6683a7e827b3fb3d273605b3461075038c6f;p=emacs.git 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 --- 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