From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: David Ventimiglia Newsgroups: gmane.emacs.bugs Subject: bug#59824: flymake-show-project-diagnotics not updating (eglot for Java with jdtls) Date: Sun, 4 Dec 2022 15:22:57 -0800 Message-ID: References: <87v8mqq3u7.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="00000000000085345505ef08da21" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="25106"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 59824@debbugs.gnu.org To: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Dec 05 00:24:19 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1p1yLL-0006KH-8n for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 05 Dec 2022 00:24:19 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p1yL6-0006gh-3O; Sun, 04 Dec 2022 18:24:04 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p1yL4-0006gG-L6 for bug-gnu-emacs@gnu.org; Sun, 04 Dec 2022 18:24:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p1yL4-0003kb-Cr for bug-gnu-emacs@gnu.org; Sun, 04 Dec 2022 18:24:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1p1yL4-0004Ir-4Q for bug-gnu-emacs@gnu.org; Sun, 04 Dec 2022 18:24:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: David Ventimiglia Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 04 Dec 2022 23:24:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 59824 X-GNU-PR-Package: emacs Original-Received: via spool by 59824-submit@debbugs.gnu.org id=B59824.167019619916528 (code B ref 59824); Sun, 04 Dec 2022 23:24:02 +0000 Original-Received: (at 59824) by debbugs.gnu.org; 4 Dec 2022 23:23:19 +0000 Original-Received: from localhost ([127.0.0.1]:60410 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p1yKM-0004IW-Uy for submit@debbugs.gnu.org; Sun, 04 Dec 2022 18:23:19 -0500 Original-Received: from mail-oi1-f180.google.com ([209.85.167.180]:38864) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p1yKI-0004IQ-5M for 59824@debbugs.gnu.org; Sun, 04 Dec 2022 18:23:17 -0500 Original-Received: by mail-oi1-f180.google.com with SMTP id s186so11093652oia.5 for <59824@debbugs.gnu.org>; Sun, 04 Dec 2022 15:23:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=neptunestation-com.20210112.gappssmtp.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=aeso1qPe7yazs6oNcHy4PkTlILSLdPCWqEd7c68pjMU=; b=Pt++SmMmzwb8d03SBgwK2RJC1cmG9EWciJqm/P2ch5UCr3LMLyKgs/319opNsT5JYp aiwkmEZ5beU65sYKETiIM1ddLwvuQLrgU/nqA53wFi+j4og2gulnkqMOZp+KswTBH1ui H5j8rFuhjRjk7knYKI6DGMYGxSEUrmoPHmoC9yfTCfbTF5D8QjCnEUKTMJo/raf1iHBF E28oZp7M5xc1ZrCYLWEoP7BLyynZzT3+w/YxMecR4yziqfspn08O+zAUUWfsZYCEJNug uGBscIvTDY4YAodiRiSI9Ev2aMy3IGsadvnoYzib8f6bwxGwZ43XOaCkVGeQ2kbxfuSi Ew1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=aeso1qPe7yazs6oNcHy4PkTlILSLdPCWqEd7c68pjMU=; b=AVgM22tpAB84UAOX7YNQP+owrsOQv/AfesbZQ7+N5LdC8NC1h880nGA+iMTa4bKUMn +7dwfRQt1gGG0KLXmkDHIRKkNLCrxkcuONh8qqe1Z8OdZFGE94KBdKAPK+f4MoV1b1jf TWiuoDjN5mMVB+rcymLG3ELx0hFgh8KaLWF2C/eZd573EnkFEHGlQC2xnG6RG/ZorTuq s+oJFiZ6cSv4IZn4+2gdWeznzvcPDPrjhMoKaFFTi+fY9v1irXgOtj7B6jrcJSCvIxQk u2iIDdHm89GgQGtShLVYA+r/lKWKeKnAeavzPEkUyciqjDGe6A+bhW0K9zHWbY9ko62W CSSQ== X-Gm-Message-State: ANoB5pneD11jC+ZftlZXo1CP589QdXnxPhwfYJY9Xa+VTrHBvEZg5zEq l7ZjZ+i8SHB4zsjzOTN14x9U1PKSNSf5Nlu8kKV/gQ== X-Google-Smtp-Source: AA0mqf407Ph8GJAwtBUvfF0efsS62/Lzf5CYCj6hesiaoKO3XRTJEokO5th47mbibRMKpoHHhxF1E60s+Fi7vDI67A4= X-Received: by 2002:a05:6808:211c:b0:35b:b20d:53c6 with SMTP id r28-20020a056808211c00b0035bb20d53c6mr17185646oiw.16.1670196188487; Sun, 04 Dec 2022 15:23:08 -0800 (PST) In-Reply-To: <87v8mqq3u7.fsf@gmail.com> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:249975 Archived-At: --00000000000085345505ef08da21 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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=3D 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=C3=A3o T=C3=A1vora = wrote: > David Ventimiglia 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=C3=A3o > > 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-diagnostic= s > #'string=3D) > 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 =3D (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)) > > > --00000000000085345505ef08da21 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
That seems to have fixed it.=C2=A0 Can you explain what= 9;s going on here?=C2=A0 To my untutored eye, it looks we're doing the = following:
  1. In addition to defining the "buffer" varia= ble from the "uri", we're now also defining "path" = from the "uri".
  2. Using the value of "path" to pu= rge all entries from "flymake-list-only-diagnostics" whose key is= string=3D to the "path".
  3. Further down in the function, n= o longer setting "path" while using cl-loop to loop over "di= agnostics", presumably because that's redundant now that "pat= h" has been defined above.
Broadly, it looks like diagno= stics 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 su= re to purge the stale cache.=C2=A0 Or something like that.=C2=A0 Am I close= ?

Thanks!
David

On Sun, Dec 4= , 2022 at 1:01 PM Jo=C3=A3o T=C3=A1vora <joaotavora@gmail.com> wrote:
David Ventimiglia <davidaventimiglia@neptune= station.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.=C2=A0 Thanks!

I may have found the possibly culprit in Eglot.=C2=A0 I wish you could try<= br> the patch after my sig, untested by me.=C2=A0 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 extr= a
step).

Jo=C3=A3o

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
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0(t=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 'eglot-note)))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(mess (source code message)=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(concat source (and = code (format " [%s]" code)) ": " message)))
-=C2=A0 =C2=A0 (if-let ((buffer (find-buffer-visiting (eglot--uri-to-path u= ri))))
+=C2=A0 =C2=A0 (if-let* ((path (expand-file-name (eglot--uri-to-path uri)))=
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (buffer (find-buffer-visi= ting path)))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(with-current-buffer buffer
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(cl-loop
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0initially (assoc-delete-all path = flymake-list-only-diagnostics #'string=3D)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 for diag-spec across diagnostics<= br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 collect (eglot--dbind ((Diagnosti= c) range code message severity source tags)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 diag-spec
@@ -2093,7 +2095,6 @@ eglot-handle-notification
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 (t
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0(setq eglot--diagnostics diags)))))
=C2=A0 =C2=A0 =C2=A0 =C2=A0(cl-loop
-=C2=A0 =C2=A0 =C2=A0 =C2=A0with path =3D (expand-file-name (eglot--uri-to-= path uri))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 for diag-spec across diagnostics
=C2=A0 =C2=A0 =C2=A0 =C2=A0 collect (eglot--dbind ((Diagnostic) code range = message severity source) diag-spec
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (setq messag= e (mess source code message))


--00000000000085345505ef08da21--