all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Theodor Thornhill via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: 59833@debbugs.gnu.org
Cc: Randy Taylor <dev@rjt.dev>, Yuan Fu <casouri@gmail.com>,
	jostein@kjonigsen.net
Subject: bug#59833: 29.0.60; json-ts-mode fontifies everything as string
Date: Mon, 05 Dec 2022 12:35:08 +0100	[thread overview]
Message-ID: <87o7sidqxf.fsf@thornhill.no> (raw)
In-Reply-To: <87sfhudrfu.fsf@thornhill.no>

[-- Attachment #1: Type: text/plain, Size: 1195 bytes --]

Theodor Thornhill <theo@thornhill.no> writes:

> Jostein Kjønigsen <jostein@secure.kjonigsen.net> writes:
>
>> Hey everyone.
>>
>> When opening a JSON-file in a build from emacs git emacs-29 
>> 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 
>> fontified as strings.
>>
>> When I change the code to disable the string-fontification rule, this 
>> yields a buffer where everything is fontified using default-face. That 
>> is, no other fontification is taking place.
>>
>> Have this mode really been tested? Should it be working? Or is there an 
>> 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


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Add-back-in-font-locking-for-pair-in-json-ts-mode.patch --]
[-- Type: text/x-diff, Size: 1325 bytes --]

From 78068ae89d178e8aac126994c82df4a294440f44 Mon Sep 17 00:00:00 2001
From: Theodor Thornhill <theo@thornhill.no>
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


  reply	other threads:[~2022-12-05 11:35 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-05 10:40 bug#59833: 29.0.60; json-ts-mode fontifies everything as string Jostein Kjønigsen
2022-12-05 11:24 ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-12-05 11:35   ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2022-12-05 11:53     ` Jostein Kjønigsen
2022-12-05 12:06       ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-12-05 13:52   ` Randy Taylor
2022-12-05 13:58     ` Randy Taylor
2022-12-05 14:12       ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-12-05 14:42         ` Randy Taylor
2022-12-05 14:52           ` Jostein Kjønigsen
2022-12-05 15:00             ` Eli Zaretskii
2022-12-05 15:01             ` Randy Taylor
2022-12-05 15:03             ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-12-05 15:35               ` Randy Taylor
2022-12-05 15:37                 ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-12-05 19:57                   ` Yuan Fu
2022-12-05 20:14                     ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-12-05 20:19                       ` Randy Taylor
2022-12-05 20:22                         ` Yuan Fu
2022-12-05 20:38                           ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87o7sidqxf.fsf@thornhill.no \
    --to=bug-gnu-emacs@gnu.org \
    --cc=59833@debbugs.gnu.org \
    --cc=casouri@gmail.com \
    --cc=dev@rjt.dev \
    --cc=jostein@kjonigsen.net \
    --cc=theo@thornhill.no \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.