[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/eglot 05c67ee 112/139: Adjust flymake integration
From: |
João Távora |
Subject: |
[elpa] externals/eglot 05c67ee 112/139: Adjust flymake integration |
Date: |
Mon, 14 May 2018 09:55:04 -0400 (EDT) |
branch: externals/eglot
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/eglot 193c57d 075/139: Half-decent xref support, (continued)
- [elpa] externals/eglot 193c57d 075/139: Half-decent xref support, João Távora, 2018/05/14
- [elpa] externals/eglot fc6879f 084/139: Explain why didOpen on after-revert-hook is a bad idea, João Távora, 2018/05/14
- [elpa] externals/eglot 24466a9 096/139: When killing server, always wait 3 seconds, João Távora, 2018/05/14
- [elpa] externals/eglot fceb6bb 090/139: Get rid of eglot--special-buffer-process, João Távora, 2018/05/14
- [elpa] externals/eglot d254f97 082/139: Solve another textDocument/didChange bug, João Távora, 2018/05/14
- [elpa] externals/eglot f257d63 089/139: * eglot.el: Reformat to shave off some lines., João Távora, 2018/05/14
- [elpa] externals/eglot c7bd095 118/139: Improve eglot-eldoc-function, João Távora, 2018/05/14
- [elpa] externals/eglot 3e0f1c3 122/139: Misc little adjustments for readability, João Távora, 2018/05/14
- [elpa] externals/eglot 3dcbc30 109/139: Add minimal headers, commentary and autoloads, João Távora, 2018/05/14
- [elpa] externals/eglot 71e47d2 102/139: Fix odd bugs and tweak stuff, João Távora, 2018/05/14
- [elpa] externals/eglot 05c67ee 112/139: Adjust flymake integration,
João Távora <=
- [elpa] externals/eglot 9ff97a6 079/139: Increase request timeout length to 10 seconds, João Távora, 2018/05/14
- [elpa] externals/eglot 571b08f 076/139: Fix the odd bug here and there, João Távora, 2018/05/14
- [elpa] externals/eglot a7ddce6 080/139: Support javascript's javascript-typescript-langserver, João Távora, 2018/05/14
- [elpa] externals/eglot d40f9ac 094/139: Half-decent imenu support via textDocument/documentSymbol, João Távora, 2018/05/14
- [elpa] externals/eglot bbc64b4 087/139: Clean up client capabilities, João Távora, 2018/05/14
- [elpa] externals/eglot 9882bf2 072/139: Cleanup mistake with TextDocumentItem and TextDocumentIdentifier, João Távora, 2018/05/14
- [elpa] externals/eglot 8160cd4 071/139: Handle dynamic registration in general (but nothing specific yet), João Távora, 2018/05/14
- [elpa] externals/eglot c4ffabc 083/139: Half-decent completion support, João Távora, 2018/05/14
- [elpa] externals/eglot d431d41 088/139: Fix bug in hover support, João Távora, 2018/05/14
- [elpa] externals/eglot 1356844 097/139: Fix odd bugs, João Távora, 2018/05/14