bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#59906: 29.0.60; typescript-ts-mode is not highlighting escape sequen


From: Jostein Kjønigsen
Subject: bug#59906: 29.0.60; typescript-ts-mode is not highlighting escape sequences
Date: Thu, 8 Dec 2022 18:23:52 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.5.1

On 08.12.2022 16:19, Theodor Thornhill wrote:
Jostein Kjønigsen <jostein@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 :)

--
Jostein






reply via email to

[Prev in Thread] Current Thread [Next in Thread]