aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoão Távora2025-04-18 19:45:54 +0100
committerJoão Távora2025-04-20 23:20:33 +0100
commit7ac6b33560a0449eb4b69664790f97124bfc2933 (patch)
treebaf86d5f8d7490ab80c2609bbe76037a2d61fcf6
parent64f4fbde8ae84c10f9e86ad1293c67ff78e867f0 (diff)
downloademacs-7ac6b33560a0449eb4b69664790f97124bfc2933.tar.gz
emacs-7ac6b33560a0449eb4b69664790f97124bfc2933.zip
Eglot: use richer diagnostic-making capability of Flymake 1.4.0
* lisp/progmodes/eglot.el (Package-Requires): Require Flymake 1.4.0. (eglot-handle-notification): Tweak.
-rw-r--r--lisp/progmodes/eglot.el14
1 files changed, 6 insertions, 8 deletions
diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el
index b077f4a6207..4121accedeb 100644
--- a/lisp/progmodes/eglot.el
+++ b/lisp/progmodes/eglot.el
@@ -7,7 +7,7 @@
7;; Maintainer: João Távora <joaotavora@gmail.com> 7;; Maintainer: João Távora <joaotavora@gmail.com>
8;; URL: https://github.com/joaotavora/eglot 8;; URL: https://github.com/joaotavora/eglot
9;; Keywords: convenience, languages 9;; Keywords: convenience, languages
10;; Package-Requires: ((emacs "26.3") (eldoc "1.14.0") (external-completion "0.1") (flymake "1.2.1") (jsonrpc "1.0.24") (project "0.9.8") (seq "2.23") (xref "1.6.2")) 10;; Package-Requires: ((emacs "26.3") (eldoc "1.14.0") (external-completion "0.1") (flymake "1.4.0") (jsonrpc "1.0.24") (project "0.9.8") (seq "2.23") (xref "1.6.2"))
11 11
12;; This is a GNU ELPA :core package. Avoid adding functionality 12;; This is a GNU ELPA :core package. Avoid adding functionality
13;; that is not available in the version of Emacs recorded above or any 13;; that is not available in the version of Emacs recorded above or any
@@ -2684,8 +2684,6 @@ expensive cached value of `file-truename'.")
2684 ((<= sev 1) 'eglot-error) 2684 ((<= sev 1) 'eglot-error)
2685 ((= sev 2) 'eglot-warning) 2685 ((= sev 2) 'eglot-warning)
2686 (t 'eglot-note))) 2686 (t 'eglot-note)))
2687 (mess (source code message)
2688 (concat source (and code (format " [%s]" code)) ": " message))
2689 (find-it (abspath) 2687 (find-it (abspath)
2690 ;; `find-buffer-visiting' would be natural, but calls the 2688 ;; `find-buffer-visiting' would be natural, but calls the
2691 ;; potentially slow `file-truename' (bug#70036). 2689 ;; potentially slow `file-truename' (bug#70036).
@@ -2706,7 +2704,6 @@ expensive cached value of `file-truename'.")
2706 for diag-spec across diagnostics 2704 for diag-spec across diagnostics
2707 collect (eglot--dbind ((Diagnostic) range code message severity source tags) 2705 collect (eglot--dbind ((Diagnostic) range code message severity source tags)
2708 diag-spec 2706 diag-spec
2709 (setq message (mess source code message))
2710 (pcase-let 2707 (pcase-let
2711 ((`(,beg . ,end) (eglot-range-region range))) 2708 ((`(,beg . ,end) (eglot-range-region range)))
2712 ;; Fallback to `flymake-diag-region' if server 2709 ;; Fallback to `flymake-diag-region' if server
@@ -2729,8 +2726,9 @@ expensive cached value of `file-truename'.")
2729 (eglot--make-diag 2726 (eglot--make-diag
2730 (current-buffer) beg end 2727 (current-buffer) beg end
2731 (eglot--diag-type severity) 2728 (eglot--diag-type severity)
2732 message `((eglot-lsp-diag . ,diag-spec) 2729 (list source code message)
2733 (eglot--doc-version . ,version)) 2730 `((eglot-lsp-diag . ,diag-spec)
2731 (eglot--doc-version . ,version))
2734 (when-let* ((faces 2732 (when-let* ((faces
2735 (cl-loop for tag across tags 2733 (cl-loop for tag across tags
2736 when (alist-get tag eglot--tag-faces) 2734 when (alist-get tag eglot--tag-faces)
@@ -2748,12 +2746,12 @@ expensive cached value of `file-truename'.")
2748 (cl-loop 2746 (cl-loop
2749 for diag-spec across diagnostics 2747 for diag-spec across diagnostics
2750 collect (eglot--dbind ((Diagnostic) code range message severity source) diag-spec 2748 collect (eglot--dbind ((Diagnostic) code range message severity source) diag-spec
2751 (setq message (mess source code message))
2752 (let* ((start (plist-get range :start)) 2749 (let* ((start (plist-get range :start))
2753 (line (1+ (plist-get start :line))) 2750 (line (1+ (plist-get start :line)))
2754 (char (1+ (plist-get start :character)))) 2751 (char (1+ (plist-get start :character))))
2755 (eglot--make-diag 2752 (eglot--make-diag
2756 path (cons line char) nil (eglot--diag-type severity) message))) 2753 path (cons line char) nil (eglot--diag-type severity)
2754 (list source code message))))
2757 into diags 2755 into diags
2758 finally 2756 finally
2759 (setq flymake-list-only-diagnostics 2757 (setq flymake-list-only-diagnostics