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#59833: 29.0.60; json-ts-mode fontifies everything as string Date: Mon, 05 Dec 2022 12:35:08 +0100 Message-ID: <87o7sidqxf.fsf@thornhill.no> References: <87sfhudrfu.fsf@thornhill.no> 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="10250"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Randy Taylor , Yuan Fu , jostein@kjonigsen.net To: 59833@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Dec 05 12:36:41 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 1p29m5-0002QA-6S for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 05 Dec 2022 12:36:41 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p29la-0006YJ-Q9; Mon, 05 Dec 2022 06:36:10 -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 1p29lS-0006Uf-J6 for bug-gnu-emacs@gnu.org; Mon, 05 Dec 2022 06:36:04 -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 1p29lS-0006ca-5s for bug-gnu-emacs@gnu.org; Mon, 05 Dec 2022 06:36:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1p29lS-0003fV-14 for bug-gnu-emacs@gnu.org; Mon, 05 Dec 2022 06:36: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: Mon, 05 Dec 2022 11:36:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 59833 X-GNU-PR-Package: emacs Original-Received: via spool by 59833-submit@debbugs.gnu.org id=B59833.167024011314091 (code B ref 59833); Mon, 05 Dec 2022 11:36:01 +0000 Original-Received: (at 59833) by debbugs.gnu.org; 5 Dec 2022 11:35:13 +0000 Original-Received: from localhost ([127.0.0.1]:35486 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p29kf-0003fD-4z for submit@debbugs.gnu.org; Mon, 05 Dec 2022 06:35:13 -0500 Original-Received: from out2.migadu.com ([188.165.223.204]:43285) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p29kd-0003f5-1Z for 59833@debbugs.gnu.org; Mon, 05 Dec 2022 06:35:12 -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=1670240110; 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=4J42m4Ex4pzwmaCVJ9xfOGkGWXV5wnVy754sI/OciNY=; b=Gn43YrbqaMrNR9v6BS1M39jcxs4UebaVS/CiTn16qFOd23NbLZX8X08UBnFvdY+a/2mTqG fOwmg67TLFA0EhgHd4gh+bBpDAdodpKHv4IYDOf5kV3G7bLcorSIOyAKZiP9jbyhGLVqlH rvNPLlRB0pttE7gSwQgbH/IPs1ik1osdKeRKsQfjTs+QbKSbTtcsM7C6dnvT3cqXGdhy7T G5EBE4xOjamcuzaP9IEwAvpG4EmkN6t9yAfqxF4+1qAxsm5ChKZB5502m+7UQzwCCbdCYc KYex+Gr+9LRIDRGWWFDlVrSRxxO5eTQRerOLyUDmrW9Tp7w3Z57PPPyQcNDOUg== In-Reply-To: <87sfhudrfu.fsf@thornhill.no> 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:250007 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Theodor Thornhill writes: > Jostein Kj=C3=B8nigsen writes: > >> Hey everyone. >> >> When opening a JSON-file in a build from emacs git emacs-29=20 >> release-branch, Emacs still defaults to json-mode. >> >> Fontification in json-mode looks correct and proper. >> >> When trying to insteas use json-ts-mode, literally everything is=20 >> fontified as strings. >> >> When I change the code to disable the string-fontification rule, this=20 >> yields a buffer where everything is fontified using default-face. That=20 >> is, no other fontification is taking place. >> >> Have this mode really been tested? Should it be working? Or is there an= =20 >> error on my end? >> >> Could someone else please give json-ts-mode a try? >> > > Yeah, you are correct. It seems we've had a regression in this commit, > 0ed313642227afdeccf48057eea458edca9d2962. > > I believe this is the offending commit - what do you think, Randy? > > Specifically the lhs should be fontified differently than the rhs, so > not everything is a string. > > Do you want to do that, Randy, or should I? > > Theo Can you test this patch, Jostein? Theo --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-Add-back-in-font-locking-for-pair-in-json-ts-mode.patch >From 78068ae89d178e8aac126994c82df4a294440f44 Mon Sep 17 00:00:00 2001 From: Theodor Thornhill Date: Mon, 5 Dec 2022 12:34:08 +0100 Subject: [PATCH] Add back in font-locking for pair in json-ts-mode * lisp/progmodes/json-ts-mode.el (json-ts-mode--font-lock-settings): Add back in removed pair font-lock code. (json-ts-mode): Use the new feature. --- lisp/progmodes/json-ts-mode.el | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lisp/progmodes/json-ts-mode.el b/lisp/progmodes/json-ts-mode.el index 101e873cf6..7ec59704dc 100644 --- a/lisp/progmodes/json-ts-mode.el +++ b/lisp/progmodes/json-ts-mode.el @@ -93,6 +93,10 @@ json-ts-mode--font-lock-settings :override t '((escape_sequence) @font-lock-escape-face) :language 'json + :feature 'pair + :override t + `((pair key: (_) @font-lock-variable-name-face)) + :language 'json :feature 'error :override t '((ERROR) @font-lock-warning-face)) @@ -156,7 +160,7 @@ json-ts-mode ;; Font-lock. (setq-local treesit-font-lock-settings json-ts-mode--font-lock-settings) (setq-local treesit-font-lock-feature-list - '((constant number string) + '((constant number string pair) (escape-sequence) (bracket delimiter error))) -- 2.34.1 --=-=-=--