GNU bug report logs - #63086
29.0.90; go-ts-mode treesit-query-error during jit-lock

Previous Next

Package: emacs;

Reported by: Jimmy Yuen Ho Wong <wyuenho <at> gmail.com>

Date: Wed, 26 Apr 2023 10:01:02 UTC

Severity: normal

Found in version 29.0.90

Done: Dmitry Gutov <dmitry <at> gutov.dev>

Bug is archived. No further changes may be made.

Full log


Message #44 received at 63086 <at> debbugs.gnu.org (full text, mbox):

From: Randy Taylor <dev <at> rjt.dev>
To: Dmitry Gutov <dmitry <at> gutov.dev>
Cc: casouri <at> gmail.com, Eli Zaretskii <eliz <at> gnu.org>, 63086 <at> debbugs.gnu.org,
 Jimmy Wong <wyuenho <at> gmail.com>
Subject: Re: bug#63086: 29.0.90; go-ts-mode treesit-query-error during jit-lock
Date: Tue, 02 May 2023 00:29:43 +0000
[Message part 1 (text/plain, inline)]
On Friday, April 28th, 2023 at 06:05, Dmitry Gutov <dmitry <at> gutov.dev> wrote:
> On 28/04/2023 04:35, Randy Taylor wrote:
> 
> > Maybe I'm missing something, but doesn't treesit-query-string with an empty string do nothing and always error, since it queries on whatever string you pass in?
> 
> 
> It would return nil, not error (querying an empty buffer). And we should
> be checking for error.
> 
> This is the part that java-ts-mode--string-highlight-helper got right, BTW.

Sorry, I was operating under false assumptions and somehow convinced myself that treesit-query-string with an empty string returning nil meant the query wasn't supported, hence me thinking it achieved nothing. I am no longer under such delusions :).

> 
> go-ts-mode--iota-query-supported-p in your patch relies on the condition
> that the file, at the time the mode is enabled, already contains at
> least one "iota" node.

Good point. I've attached a patch using treesit-query-string with an empty string. It now works properly when iota is missing but inserted later.

> 
> > In that case, wouldn't using treesit-query-capture directly be the best? I don't understand why it's not from reading that thread. If it isn't, then treesit-query-validate is the only option, right?
> 
> 
> treesit-query-validate pops a new buffer interactively in the case of
> failure, so it's not something we should use here.
[0001-go-ts-mode-Use-iota-query-only-if-supported-Bug-6308.patch (text/x-patch, attachment)]

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

Previous Next


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