GNU bug report logs - #59906
29.0.60; typescript-ts-mode is not highlighting escape sequences

Previous Next

Package: emacs;

Reported by: Jostein Kjønigsen <jostein <at> secure.kjonigsen.net>

Date: Thu, 8 Dec 2022 15:05:02 UTC

Severity: normal

Found in version 29.0.60

Done: Yuan Fu <casouri <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


Message #16 received at 59906-done <at> debbugs.gnu.org (full text, mbox):

From: Yuan Fu <casouri <at> gmail.com>
To: Jostein Kjønigsen <jostein <at> secure.kjonigsen.net>
Cc: jostein <at> kjonigsen.net, 59906-done <at> debbugs.gnu.org,
 Theodor Thornhill <theo <at> thornhill.no>
Subject: Re: bug#59906: 29.0.60; typescript-ts-mode is not highlighting 
 escape sequences
Date: Fri, 9 Dec 2022 12:41:59 -0800
Jostein Kjønigsen <jostein <at> secure.kjonigsen.net> writes:

> On 08.12.2022 16:19, Theodor Thornhill wrote:
>> Jostein Kjønigsen <jostein <at> secure.kjonigsen.net> writes:
>>
>>> In a buffer with typescript-ts-mode activated, write the following code:
>>>
>>> const test = "quoted\"string\" contents";
>>>
>>> The entire text, include the \" is highlighted as strings, and escape sequences are not handled:
>>>
>>> This code has the following tree-sitter syntax tree:
>>>
>>>   (lexical_declaration kind: const
>>>    (variable_declarator name: (identifier) value: =
>>>     (string " (string_fragment) (escape_sequence) (string_fragment) (escape_sequence) (string_fragment) "))
>>>    ;)
>>>
>>> In typescript-ts-mode we seemingly have rules to handle fontification of escape sequences:
>>>
>>>      :language language
>>>      :feature 'escape-sequence
>>>      :override t
>>>      '((escape_sequence) @font-lock-escape-face))
>>>
>>> This feature is however not activated in the major-mode setup:
>>>
>>>       (setq-local treesit-font-lock-feature-list
>>>                   '((comment declaration)
>>>                     (keyword string)
>>>                     (constant expression identifier number pattern property)
>>>                     (bracket delimiter)))
>>>
>>> Naively I assumed that simply adding this feature would activate this rule, but still \" is fontified as string.
>> Yeah, there was an error there.  See below patch.
>>
>> Yuan, can you install this?
>>
>> Theo
>>
> Yeah that works for me.
>
> Yuan: another vote for installing right here :)

Yep, applied, many thanks!

Yuan




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

Previous Next


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