GNU bug report logs -
#75198
31.0.50; [treesitter] peculiar error
Previous Next
Reported by: German Pacenza <germanp82 <at> hotmail.com>
Date: Mon, 30 Dec 2024 12:33:01 UTC
Severity: normal
Fixed in version 31.0.50
Done: Juri Linkov <juri <at> linkov.net>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
> On Jan 4, 2025, at 9:43 AM, Juri Linkov <juri <at> linkov.net> wrote:
>
>>> The problem is that 'treesit-parent-until' raises an error by default.
>>> So needed to copy its implementation where treesit-node-match-p
>>> sets the argument IGNORE-MISSING to t.
>>>
>>> Or maybe better to add new arg IGNORE-MISSING to treesit-parent-until.
>>
>> Hmm, I’m not sure. If we go this route, we’d need to add IGNORE-MISSING for
>> every single function that uses treesit-node-match-p.
>
> Agreed, adding a new arg to all such functions is not the right thing.
>
> Then maybe better to define the preferred behavior
> by a new dynamically bound variable, e.g.
> (let ((treesit-raise-error t)) (treesit-parent-until ... pred))
>
>> It’s better for these functions to check whether the definition of the
>> thing they’re going to use exists or not, before calling
>> treesit-node-match-p; alternatively, if they know they don’t care,
>> they can pass t to IGNORE-MISSING.
>
> Not sure how much this will degrade the performance of
> every function that uses treesit-node-match-p.
It should be negligible, plus if a function wants to use a thing, it’s TRT to first check if the thing exists, right? Otherwise they can just pass IGNORE-MISSING.
There might be cases where the function can’t know whether they can ignore missing. In that case they can expose the IGNORE-MISSING parameter in their signature.
Treesit-raise-error-p could make sense, but it’s a rather significant commitment and I don’t see any strong argument for it as for now.
Yuan
This bug report was last modified 136 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.