GNU bug report logs -
#67684
30.0.50; Font lock rule conflict in js-ts-mode at level 4
Previous Next
Reported by: Loïc Lemaître <loic.lemaitre <at> gmail.com>
Date: Thu, 7 Dec 2023 10:09:02 UTC
Severity: normal
Found in version 30.0.50
Fixed in version 29.2
Done: Dmitry Gutov <dmitry <at> gutov.dev>
Bug is archived. No further changes may be made.
Full log
Message #17 received at 67684 <at> debbugs.gnu.org (full text, mbox):
On 11/12/2023 03:37, Yuan Fu wrote:
>
>
> On 12/7/23 5:33 PM, Dmitry Gutov wrote:
>> Hi!
>>
>> On 07/12/2023 12:07, Loïc Lemaître wrote:
>>> I have noticed a font coloration issue in js-ts-mode when setting the
>>> treesit font lock level to 4: JSX attributes color is not the same
>>> than at level 3.
>>> There should have a conflict between rules for "property_identifier"
>>> treesit type. The feature that triggers the conflict is "property"
>>> (of the level 4).
>>>
>>> You can reproduce the issue by following these steps:
>>> - M-: (setq treesit-font-lock-level 4)
>>> - M-x js-ts-mode on a JSX buffer
>>>
>>> Note that the bug already exists in Emacs 29.1.
>>
>> The attached patch seems to fix that.
>>
>> But it removes a function added by Yuan in e78e69b33189, while
>> reshuffling the highlights to reorder priorities.
>>
>> Yuan, do you remember why you did it that way back then? Perhaps I'm
>> missing some other conflict.
> For a method invocation like obj.fn(), the "fn" should be fontified in
> function-call-face. However, "fn" is a property_identifier in the parse
> tree, so it would be fontified in property-use-face by the property
> feature. The predicate in the property feature makes sure we skip
> properties that are function invocations. And down the line in function
> feature, you'll see
>
> (call_expression
> function: [(identifier) @font-lock-function-call-face
> (member_expression
> property:
> (property_identifier) @font-lock-function-call-face)])
>
> Here, the property_identifier is fontified in function-call-face.
Thanks. So the patch I sent should also cover this, right?
It moves the 'property' feature to below 'function'. And below 'jsx',
which fixes the problem reported in this bug.
This bug report was last modified 1 year and 239 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.