[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/elpa 05c67ee 112/139: Adjust flymake integration
From: |
João Távora |
Subject: |
[elpa] externals/elpa 05c67ee 112/139: Adjust flymake integration |
Date: |
Mon, 14 May 2018 09:53:46 -0400 (EDT) |
branch: externals/elpa
commit 05c67eece9a94cf9f8ee58b18fb4a1318b2425b3
Author: João Távora <address@hidden>
Commit: João Távora <address@hidden>
Adjust flymake integration
When opening a new file (signalling textDocument/didOpen) it makes
sense to call the flymake callback (if it exists) with no diagnostics,
just to get rid of that "Wait", since we don't know if later in this
callback cycle the server will ever report new diagnostics.
* eglot.el (eglot--managed-mode): Don't call flymake-mode or eldoc-mode
(eglot--managed-mode-hook): Add them here.
(eglot--maybe-activate-editing-mode): Call flymake callback.
(eglot--server-textDocument/publishDiagnostics): Set unreported
diagnostics to nil if invoking callback.
---
eglot.el | 29 ++++++++++++++---------------
1 file changed, 14 insertions(+), 15 deletions(-)
diff --git a/eglot.el b/eglot.el
index 21ec247..f865c22 100644
--- a/eglot.el
+++ b/eglot.el
@@ -798,9 +798,7 @@ DEFERRED is passed to `eglot--request', which see."
(add-hook 'completion-at-point-functions #'eglot-completion-at-point nil t)
(add-function :before-until (local 'eldoc-documentation-function)
#'eglot-eldoc-function)
- (add-function :around (local imenu-create-index-function) #'eglot-imenu)
- (flymake-mode 1)
- (eldoc-mode 1))
+ (add-function :around (local imenu-create-index-function) #'eglot-imenu))
(t
(remove-hook 'flymake-diagnostic-functions 'eglot-flymake-backend t)
(remove-hook 'after-change-functions 'eglot--after-change t)
@@ -818,6 +816,9 @@ DEFERRED is passed to `eglot--request', which see."
(when (and (process-live-p proc) (y-or-n-p "[eglot] Kill server too? "))
(eglot-shutdown proc t))))))
+(add-hook 'eglot--managed-mode-hook 'flymake-mode)
+(add-hook 'eglot--managed-mode-hook 'eldoc-mode)
+
(defun eglot--buffer-managed-p (&optional proc)
"Tell if current buffer is managed by PROC."
(and buffer-file-name (let ((cur (eglot--current-process)))
@@ -832,7 +833,8 @@ that case, also signal textDocument/didOpen."
(when (eglot--buffer-managed-p proc)
(eglot--managed-mode 1)
(eglot--signal-textDocument/didOpen)
- (flymake-start)))
+ (flymake-start)
+ (funcall (or eglot--current-flymake-report-fn #'ignore) nil)))
(add-hook 'find-file-hook 'eglot--maybe-activate-editing-mode)
@@ -999,11 +1001,11 @@ called interactively."
(t :note))
(concat source ": " message)))))
into diags
- finally (if eglot--current-flymake-report-fn
- (funcall eglot--current-flymake-report-fn
- diags)
- (setq eglot--unreported-diagnostics
- diags)))))
+ finally (cond (eglot--current-flymake-report-fn
+ (funcall eglot--current-flymake-report-fn diags)
+ (setq eglot--unreported-diagnostics nil))
+ (t
+ (setq eglot--unreported-diagnostics diags))))))
(t
(eglot--message "OK so %s isn't visited" filename)))))
@@ -1174,15 +1176,12 @@ Records START, END and PRE-CHANGE-LENGTH locally."
(defun eglot-flymake-backend (report-fn &rest _more)
"An EGLOT Flymake backend.
Calls REPORT-FN maybe if server publishes diagnostics in time."
- ;; Maybe call immediately if anything unreported (this will clear
- ;; any pending diags)
+ (setq eglot--current-flymake-report-fn report-fn)
+ ;; Report anything unreported
(when eglot--unreported-diagnostics
(funcall report-fn eglot--unreported-diagnostics)
(setq eglot--unreported-diagnostics nil))
- ;; Setup so maybe it's called later, too.
- (setq eglot--current-flymake-report-fn report-fn)
- ;; Take this opportunity to signal a didChange that might eventually
- ;; make the server report new diagnostics.
+ ;; Signal a didChange that might eventually bring new diagnotics
(eglot--signal-textDocument/didChange))
(defun eglot-xref-backend ()
- [elpa] externals/elpa d33a9b5 103/139: Simplify eglot--signal-textDocument/didChange, (continued)
- [elpa] externals/elpa d33a9b5 103/139: Simplify eglot--signal-textDocument/didChange, João Távora, 2018/05/14
- [elpa] externals/elpa 56c2e1d 104/139: Get rid of eglot-mode, João Távora, 2018/05/14
- [elpa] externals/elpa bbc64b4 087/139: Clean up client capabilities, João Távora, 2018/05/14
- [elpa] externals/elpa 23b79e0 111/139: Shorten summary line to appease package-lint.el, João Távora, 2018/05/14
- [elpa] externals/elpa 24466a9 096/139: When killing server, always wait 3 seconds, João Távora, 2018/05/14
- [elpa] externals/elpa 3a6c637 099/139: Support textDocument/rename, João Távora, 2018/05/14
- [elpa] externals/elpa 458bc69 110/139: More correctly setup rust-mode-related autoloads, João Távora, 2018/05/14
- [elpa] externals/elpa 3dcbc30 109/139: Add minimal headers, commentary and autoloads, João Távora, 2018/05/14
- [elpa] externals/elpa 581608f 115/139: Resist server failure during synchronous requests, João Távora, 2018/05/14
- [elpa] externals/elpa 41f5922 137/139: Now send willSaveWaitUntil, João Távora, 2018/05/14
- [elpa] externals/elpa 05c67ee 112/139: Adjust flymake integration,
João Távora <=
- [elpa] externals/elpa f89f859 114/139: Simplify mode-line updating logic, João Távora, 2018/05/14
- [elpa] externals/elpa 0625b6c 123/139: (eglot--xref-make): Fix Use of cl-destructuring-bind., João Távora, 2018/05/14
- [elpa] externals/elpa 56cf02d 126/139: Rework autoreconnection logic, João Távora, 2018/05/14
- [elpa] externals/elpa 49fb02f 135/139: Use RLS in Travis CI and add actual tests, João Távora, 2018/05/14
- [elpa] externals/elpa 29f58a6 127/139: Get rid of catch/loop/throw idiom (suggested by Thien-Thi Nguyen), João Távora, 2018/05/14
- [elpa] externals/elpa 418412b 131/139: Fix copyright header. Obviously not since 2003, João Távora, 2018/05/14
- [elpa] externals/elpa 54fc885 113/139: More RLS-specifics: update Flymake diags when indexing done, João Távora, 2018/05/14
- [elpa] externals/elpa 8a80fb7 105/139: Simplify `eglot-shutdown`, João Távora, 2018/05/14
- [elpa] externals/elpa d40f9ac 094/139: Half-decent imenu support via textDocument/documentSymbol, João Távora, 2018/05/14
- [elpa] externals/elpa 42177d0 107/139: New "deferred requests" that wait until server is ready, João Távora, 2018/05/14