GNU bug report logs - #59824
flymake-show-project-diagnotics not updating (eglot for Java with jdtls)

Previous Next

Package: emacs;

Reported by: João Távora <joaotavora <at> gmail.com>

Date: Sun, 4 Dec 2022 20:48:02 UTC

Severity: normal

Done: João Távora <joaotavora <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: David Ventimiglia <davidaventimiglia <at> neptunestation.com>
To: João Távora <joaotavora <at> gmail.com>
Cc: 59824 <at> debbugs.gnu.org
Subject: bug#59824: flymake-show-project-diagnotics not updating (eglot for Java with jdtls)
Date: Sun, 4 Dec 2022 15:22:57 -0800
[Message part 1 (text/plain, inline)]
That seems to have fixed it.  Can you explain what's going on here?  To my
untutored eye, it looks we're doing the following:

   1. In addition to defining the "buffer" variable from the "uri", we're
   now also defining "path" from the "uri".
   2. Using the value of "path" to purge all entries from
   "flymake-list-only-diagnostics" whose key is string= to the "path".
   3. Further down in the function, no longer setting "path" while using
   cl-loop to loop over "diagnostics", presumably because that's redundant now
   that "path" has been defined above.

Broadly, it looks like diagnostics were sorta *cached* and if the eglot
backed publishes an empty set of diagnostics for a file (i.e., the file has
been corrected) then we make sure to purge the stale cache.  Or something
like that.  Am I close?

Thanks!
David

On Sun, Dec 4, 2022 at 1:01 PM João Távora <joaotavora <at> gmail.com> wrote:

> David Ventimiglia <davidaventimiglia <at> neptunestation.com> writes:
>
> > I grant that this may not be a bug and could be a mis-configuration,
> > but I am trying to track that down.  Thanks!
>
> I may have found the possibly culprit in Eglot.  I wish you could try
> the patch after my sig, untested by me.  Also, if you find that the
> project listing still doesn't update automatically, please go to its
> buffer and type 'g' (and report back here that you needed this extra
> step).
>
> João
>
> diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el
> index e057b12e0ee..3d0e97bba8c 100644
> --- a/lisp/progmodes/eglot.el
> +++ b/lisp/progmodes/eglot.el
> @@ -2048,9 +2048,11 @@ eglot-handle-notification
>                      (t          'eglot-note)))
>              (mess (source code message)
>                (concat source (and code (format " [%s]" code)) ": "
> message)))
> -    (if-let ((buffer (find-buffer-visiting (eglot--uri-to-path uri))))
> +    (if-let* ((path (expand-file-name (eglot--uri-to-path uri)))
> +              (buffer (find-buffer-visiting path)))
>          (with-current-buffer buffer
>            (cl-loop
> +           initially (assoc-delete-all path flymake-list-only-diagnostics
> #'string=)
>             for diag-spec across diagnostics
>             collect (eglot--dbind ((Diagnostic) range code message
> severity source tags)
>                         diag-spec
> @@ -2093,7 +2095,6 @@ eglot-handle-notification
>                           (t
>                            (setq eglot--diagnostics diags)))))
>        (cl-loop
> -       with path = (expand-file-name (eglot--uri-to-path uri))
>         for diag-spec across diagnostics
>         collect (eglot--dbind ((Diagnostic) code range message severity
> source) diag-spec
>                   (setq message (mess source code message))
>
>
>
[Message part 2 (text/html, inline)]

This bug report was last modified 2 years and 167 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.