emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/eglot 561203a208 1/2: Consider Diagnostic.code when gen


From: ELPA Syncer
Subject: [elpa] externals/eglot 561203a208 1/2: Consider Diagnostic.code when generating Flymake diagnostics
Date: Sun, 8 May 2022 20:57:29 -0400 (EDT)

branch: externals/eglot
commit 561203a20859a0c3466cf28409d82b7620d9df40
Author: João Távora <joaotavora@gmail.com>
Commit: João Távora <joaotavora@gmail.com>

    Consider Diagnostic.code when generating Flymake diagnostics
    
    Not sure this will please everybody, can almost guess someone is going
    to ask for a custom switch.
    
    Instead this info (and the source) should be passed on to Flymake.
    That's where the custom switch for controlling formatting of
    diagnostic messages should exist.  But that's too much work right now.
    
    * eglot.el (eglot-handle-notification): Consider Diagnostic.code.
---
 eglot.el | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/eglot.el b/eglot.el
index 81c545e64f..3a33ad3ec2 100644
--- a/eglot.el
+++ b/eglot.el
@@ -1957,14 +1957,16 @@ COMMAND is a symbol naming the command."
               (cond ((null sev) 'eglot-error)
                     ((<= sev 1) 'eglot-error)
                     ((= sev 2)  'eglot-warning)
-                    (t          'eglot-note))))
+                    (t          'eglot-note)))
+            (mess (source code message)
+              (concat source (and code (concat " [" code "]")) ": " message)))
     (if-let ((buffer (find-buffer-visiting (eglot--uri-to-path uri))))
         (with-current-buffer buffer
           (cl-loop
            for diag-spec across diagnostics
-           collect (eglot--dbind ((Diagnostic) range message severity source 
tags)
+           collect (eglot--dbind ((Diagnostic) range code message severity 
source tags)
                        diag-spec
-                     (setq message (concat source ": " message))
+                     (setq message (mess source code message))
                      (pcase-let
                          ((`(,beg . ,end) (eglot--range-region range)))
                        ;; Fallback to `flymake-diag-region' if server
@@ -2001,8 +2003,8 @@ COMMAND is a symbol naming the command."
       (cl-loop
        with path = (expand-file-name (eglot--uri-to-path uri))
        for diag-spec across diagnostics
-       collect (eglot--dbind ((Diagnostic) range message severity source) 
diag-spec
-                 (setq message (concat source ": " message))
+       collect (eglot--dbind ((Diagnostic) code range message severity source) 
diag-spec
+                 (setq message (mess source code message))
                  (let* ((start (plist-get range :start))
                         (line (1+ (plist-get start :line)))
                         (char (1+ (plist-get start :character))))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]