From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Theodor Thornhill via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#59906: 29.0.60; typescript-ts-mode is not highlighting escape sequences Date: Thu, 08 Dec 2022 16:19:51 +0100 Message-ID: <87cz8tdiso.fsf@thornhill.no> References: Reply-To: Theodor Thornhill Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="38270"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 59906@debbugs.gnu.org, casouri@gmail.com To: Jostein =?UTF-8?Q?Kj=C3=B8nigsen?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Dec 08 16:20:27 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1p3IhH-0009lk-2q for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 08 Dec 2022 16:20:27 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p3Ih9-0008Cj-Gz; Thu, 08 Dec 2022 10:20:19 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p3Ih2-0008CR-Is for bug-gnu-emacs@gnu.org; Thu, 08 Dec 2022 10:20:13 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p3Igs-0004gw-Di for bug-gnu-emacs@gnu.org; Thu, 08 Dec 2022 10:20:12 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1p3Igs-000425-8i for bug-gnu-emacs@gnu.org; Thu, 08 Dec 2022 10:20:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Theodor Thornhill Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 08 Dec 2022 15:20:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 59906 X-GNU-PR-Package: emacs Original-Received: via spool by 59906-submit@debbugs.gnu.org id=B59906.167051279615491 (code B ref 59906); Thu, 08 Dec 2022 15:20:02 +0000 Original-Received: (at 59906) by debbugs.gnu.org; 8 Dec 2022 15:19:56 +0000 Original-Received: from localhost ([127.0.0.1]:57376 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p3Igm-00041n-BP for submit@debbugs.gnu.org; Thu, 08 Dec 2022 10:19:56 -0500 Original-Received: from out2.migadu.com ([188.165.223.204]:58331) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p3Igj-00041g-Ox for 59906@debbugs.gnu.org; Thu, 08 Dec 2022 10:19:54 -0500 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thornhill.no; s=key1; t=1670512792; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=XrJzcfchbRdQirvGGf2c4u8sZBRTDNxezJvwrWWu+Jc=; b=UwDeN0mAY3cGHBvKFoyrb/fGaeMwKwtqaXDzXSZXhsi3w9v2+6xbAGnLSBNToPrBcLSs3T KOCaABpvPSaIWWjO+9U3QIIbBXufgwoCVgqAgjEtTvkULdgFP+tnorJSnIjcDmE0B5WbuT fmGYcGsolxoAZKAYaNhEM5HOGL6JB4LM192ve0GJqOSFwK9apQ6DPhq9TC5eBBSPhZTx1S 1yZRXRaNRNEgbOSxjg6nJvr0Jn1lnu3KWIkL9MJ9GCPMc0cBAdoFERZklMh9bHbdkppmbQ Tno0FLX7k27b3hBLwA68GZIk3hWngTy8yAp4DdJXihOADf9CiAfZ0DRG1iJ4ig== In-Reply-To: ("Jostein =?UTF-8?Q?Kj=C3=B8nigsen?="'s message of "Thu, 8 Dec 2022 16:04:05 +0100") X-Migadu-Flow: FLOW_OUT X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:250307 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Jostein Kj=C3=B8nigsen writes: > In a buffer with typescript-ts-mode activated, write the following code: > > const test =3D "quoted\"string\" contents"; > > The entire text, include the \" is highlighted as strings, and escape seq= uences are not handled: > > This code has the following tree-sitter syntax tree: > > (lexical_declaration kind: const > (variable_declarator name: (identifier) value: =3D > (string " (string_fragment) (escape_sequence) (string_fragment) (escap= e_sequence) (string_fragment) ")) > ;) > > In typescript-ts-mode we seemingly have rules to handle fontification of = escape sequences:=20 > > :language language > :feature 'escape-sequence > :override t > '((escape_sequence) @font-lock-escape-face)) > > This feature is however not activated in the major-mode setup:=20 > > (setq-local treesit-font-lock-feature-list > '((comment declaration) > (keyword string) > (constant expression identifier number pattern propert= y) > (bracket delimiter))) > > Naively I assumed that simply adding this feature would activate this rul= e, but still \" is fontified as string. Yeah, there was an error there. See below patch. Yuan, can you install this? Theo --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-Fix-escape-sequence-feature-in-typescript-ts-mode-bu.patch >From 1b0f2a181c38902804e323b064ab85cf84d88ff5 Mon Sep 17 00:00:00 2001 From: Theodor Thornhill Date: Thu, 8 Dec 2022 16:17:49 +0100 Subject: [PATCH] Fix escape-sequence feature in typescript-ts-mode (bug#59906) * lisp/progmodes/typescript-ts-mode.el: (typescript-ts-mode, tsx-ts-mode): Use escape-sequence feature. --- lisp/progmodes/typescript-ts-mode.el | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lisp/progmodes/typescript-ts-mode.el b/lisp/progmodes/typescript-ts-mode.el index a56568ae78..d5ca813e34 100644 --- a/lisp/progmodes/typescript-ts-mode.el +++ b/lisp/progmodes/typescript-ts-mode.el @@ -362,8 +362,7 @@ typescript-ts-mode (setq-local treesit-font-lock-settings (typescript-ts-mode--font-lock-settings 'typescript)) (setq-local treesit-font-lock-feature-list - '((comment declaration) - (keyword string) + '((comment declaration keyword string escape-sequence) (constant expression identifier number pattern property) (bracket delimiter))) @@ -397,8 +396,7 @@ tsx-ts-mode (setq-local treesit-font-lock-settings (typescript-ts-mode--font-lock-settings 'tsx)) (setq-local treesit-font-lock-feature-list - '((comment declaration) - (keyword string) + '((comment declaration keyword string escape-sequence) (constant expression identifier jsx number pattern property) (bracket delimiter))) -- 2.34.1 --=-=-=--