From: João Távora Date: Fri, 8 Jun 2018 17:48:06 +0000 (+0100) Subject: Merge master into jsonrpc-refactor X-Git-Tag: emacs-29.0.90~1616^2~524^2~4^2~489^2~6 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=75c6d5b9d32da048b6af7802f74b3895b89cd07e;p=emacs.git Merge master into jsonrpc-refactor --- 75c6d5b9d32da048b6af7802f74b3895b89cd07e diff --cc lisp/progmodes/eglot.el index cdb1c5b097c,81a63fdbea9..70d133bc49f --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el @@@ -590,20 -900,18 +590,24 @@@ If optional MARKERS, make markers. (add-hook 'eglot--managed-mode-hook 'flymake-mode) (add-hook 'eglot--managed-mode-hook 'eldoc-mode) +(defun eglot--find-current-server () + "Find the current logical EGLOT server." + (let* ((probe (or (project-current) `(transient . ,default-directory)))) + (cl-find major-mode (gethash probe eglot--servers-by-project) + :key #'eglot--major-mode))) + + (defvar-local eglot--unreported-diagnostics nil + "Unreported Flymake diagnostics for this buffer.") + (defun eglot--maybe-activate-editing-mode (&optional server) "Maybe activate mode function `eglot--managed-mode'. If SERVER is supplied, do it only if BUFFER is managed by it. In that case, also signal textDocument/didOpen." ;; Called even when revert-buffer-in-progress-p - (let* ((cur (and buffer-file-name (eglot--current-server))) + (let* ((cur (and buffer-file-name (eglot--find-current-server))) (server (or (and (null server) cur) (and server (eq server cur) cur)))) (when server + (setq eglot--unreported-diagnostics `(:just-opened . nil)) (eglot--managed-mode-onoff server 1) (eglot--signal-textDocument/didOpen)))) @@@ -727,14 -1058,11 +731,11 @@@ Uses THING, FACE, DEFS and PREPEND. "Handle notification window/logMessage") ;; noop, use events buffer (cl-defmethod eglot-handle-notification - (_server (_method (eql :telemetry/event)) &rest _any) + (_server (_method (eql telemetry/event)) &rest _any) "Handle notification telemetry/event") ;; noop, use events buffer - (defvar-local eglot--unreported-diagnostics nil - "Unreported diagnostics for this buffer.") - (cl-defmethod eglot-handle-notification - (server (_method (eql :textDocument/publishDiagnostics)) &key uri diagnostics) + (server (_method (eql textDocument/publishDiagnostics)) &key uri diagnostics) "Handle notification publishDiagnostics" (if-let ((buffer (find-buffer-visiting (eglot--uri-to-path uri)))) (with-current-buffer buffer