From: Theodor Thornhill via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Mickey Petersen <mickey@masteringemacs.org>
Cc: 61043@debbugs.gnu.org, Dmitry Gutov <dgutov@yandex.ru>
Subject: bug#61043: 30.0.50; `json-ts-mode': invalid font lock rule
Date: Wed, 25 Jan 2023 14:14:11 +0100 [thread overview]
Message-ID: <FC84698B-B2E2-46E3-AFEF-477327AC2169@thornhill.no> (raw)
In-Reply-To: <87ilgu3jdb.fsf@masteringemacs.org>
On 25 January 2023 13:09:08 CET, Mickey Petersen <mickey@masteringemacs.org> wrote:
>
>Theodor Thornhill <theo@thornhill.no> writes:
>
>> Mickey Petersen <mickey@masteringemacs.org> writes:
>>
>>> Dmitry Gutov <dgutov@yandex.ru> writes:
>>>
>>>> On 24/01/2023 22:09, Mickey Petersen wrote:
>>>>> There's a comment font lock rule in `json-ts-mode'. However, that is
>>>>> illegal and againt the JSON spec, and indeed the search query fails
>>>>> because `comment' is not a valid node type.
>>>>
>>>> When you say it fails, how does that look to you?
>>>>
>>>> Here's an example of a JSON file (or, more accurately, a JSON-superset
>>>> file) with comments:
>>>> https://raw.githubusercontent.com/huytd/vscode-espresso-tutti/master/themes/Espresso%20Tutti-color-theme.json
>>>>
>>>> The JSON tree-sitter grammar seems to parse them correctly as comments
>>>> ("comment" node type), and json-ts-mode highlights them as comments
>>>> correctly as a result.
>>>
>>> It may well be my JSON grammar file that is different then. Which is
>>> perhaps even worse: it is easy to find yourself with one of two
>>> versions.
>>
>>
>> See [0], it seems comment is supported if I'm not mistaken.
>>
>> Theo
>>
>> [0]: https://github.com/tree-sitter/tree-sitter-json/blob/master/grammar.js#L6
>
>I understand. But nevertheless, I do get an error for that rule as it's missing (for some inexplicable reason.)
>
>It would be better if the font lock machinery disables/ignores the rule if it encounters a validation error. That way it'll gracefully degrade.
>
Yeah but this touches a deeper point, imo.
There's no good way to version this. Perhaps when we stop committing treesit stuff to emacs-29 we create a list of verified git commit hashes that are supported by the mode? That way we at least have _some_ info.
What do you think?
Theo
next prev parent reply other threads:[~2023-01-25 13:14 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-24 20:09 bug#61043: 30.0.50; `json-ts-mode': invalid font lock rule Mickey Petersen
2023-01-24 21:08 ` Drew Adams
2023-01-24 21:10 ` Drew Adams
2023-01-25 7:27 ` Mickey Petersen
2023-01-25 1:28 ` Dmitry Gutov
2023-01-25 7:29 ` Mickey Petersen
2023-01-25 12:08 ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-01-25 12:09 ` Mickey Petersen
2023-01-25 13:14 ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2023-01-25 13:30 ` Dmitry Gutov
2023-01-25 13:00 ` Eli Zaretskii
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=FC84698B-B2E2-46E3-AFEF-477327AC2169@thornhill.no \
--to=bug-gnu-emacs@gnu.org \
--cc=61043@debbugs.gnu.org \
--cc=dgutov@yandex.ru \
--cc=mickey@masteringemacs.org \
--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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).