From 18b582dde2ef0275561a66fb292823f559ed7a0b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jo=C3=A3o=20T=C3=A1vora?= Date: Wed, 16 Aug 2017 12:49:24 +0100 Subject: [PATCH] Handle notifications --- lisp/progmodes/eglot.el | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index 5ca6833de71..6e3a1365962 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el @@ -287,8 +287,13 @@ (t (apply (first continuations) (plist-get message :result))))) (t - (eglot--debug "No implemetation for notification %s yet" - (plist-get message :method)))))) + (let* ((method (plist-get message :method)) + (handler-sym (intern (concat "eglot--" + method)))) + (if (functionp handler-sym) + (apply handler-sym proc (plist-get message :params)) + (eglot--debug "No implemetation for notification %s yet" + method))))))) (defvar eglot--expect-carriage-return nil) @@ -391,6 +396,14 @@ (length all))))))) (defun eglot--debug (format &rest args) + +;;; Notifications +;;; +(cl-defun eglot--textDocument/publishDiagnostics + (_process &key uri diagnostics) + "Handle notification publishDiagnostics" + (eglot--message "So yeah I got %s for %s" + diagnostics uri)) (display-warning 'eglot (apply #'format format args) :debug)) -- 2.39.2