emacs-devel
[Top][All Lists]
Advanced

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

Re: Validating tree-sitter major modes and grammar


From: Yuan Fu
Subject: Re: Validating tree-sitter major modes and grammar
Date: Tue, 24 Dec 2024 13:30:43 -0800


> On Dec 24, 2024, at 4:19 AM, Eli Zaretskii <eliz@gnu.org> wrote:
> 
>> From: Yuan Fu <casouri@gmail.com>
>> Date: Mon, 23 Dec 2024 19:12:18 -0800
>> Cc: Peter Oliver <p.d.oliver@mavit.org.uk>,
>> Björn Bidar <bjorn.bidar@thaodan.de>,
>> Stefan Kangas <stefankangas@gmail.com>,
>> Perry Smith <pedz@easesoftware.com>, Perry Smith <pedz@easesoftware.com>,
>> Jostein Kjønigsen <jostein@secure.kjonigsen.net>,
>> Theodor Thornhill <theo@thornhill.no>,
>> Vincenzo Pupillo <v.pupillo@gmail.com>, Randy Taylor <dev@rjt.dev>,
>> Wilhelm Kirschbaum <wkirschbaum@gmail.com>, john muhl <jm@pub.pink>,
>> Dmitry Gutov <dgutov@yandex.ru>, john muhl <jm@pub.pink>,
>> Juri Linkov <juri@linkov.net>
>> 
>> 
>> 
>>> On Dec 20, 2024, at 1:09 AM, Yuan Fu <casouri@gmail.com> wrote:
>>> 
>>> Continuing from the tree-sitter maternity thread, I cooked up some script 
>>> to go over each builtin tree-sitter mode, clone the grammars it uses, and 
>>> check whether the font-lock queries are compatible with the latest version 
>>> of the grammar. If everything works fine, the script adds some comment in 
>>> the source file listing the version that was checked.
>>> 
>>> For example, I ran the script for c-ts-mode and c++-ts-mode, and this is 
>>> the comment inserted to c-ts-mode.el:
>>> 
>>> ;;; Tree-sitter language versions
>>> ;;
>>> ;; c-ts-mode is known to work with the following languages and version:
>>> ;; - tree-sitter-c: v0.23.4
>>> ;;
>>> ;; c++-ts-mode is known to work with the following languages and version:
>>> ;; - tree-sitter-cpp: v0.23.4-1-gf41b4f6
>>> ;;
>>> ;; We try our best to make builtin modes work with latest grammar
>>> ;; versions, so a more recent grammar version has a good chance to work.
>>> ;; Send us a bug report if it doesn't.
>>> 
>>> The version is taken from “git describe”. If the grammar isn’t versioned, 
>>> it’ll just be the hash of HEAD. In order for “git describe” to work, I had 
>>> to do full clones, and some tree-sitter grammar’s repo is very slow to 
>>> clone. I wonder if there’s anything we can do to speed it up? 
>>> 
>>> Any thoughts/comments? I pushed the code to master so others can play with 
>>> it.
>>> 
>>> BTW, the script revealed that cmake-ts-mode isn’t compatible with the 
>>> latest grammar. I’ll try fix it later.
>> 
>> (This is now fixed.)
>> 
>> 
>> 
>> CC’ing maintainers for builtin modes for comments. Also, Eli, what’s your 
>> thoughts on this after the clarification? 
> 
> Sorry, I thought we had this discussion concluded and closed.  What
> are the issues that still need decisions?

About running the script semi-regularly and adding recommended version comments 
to builtin modes. Are there any concerns?

If most people think it’s a good idea, I’ll run the script for all the builtin 
modes, which will add the comments. And I plan to run it myself from time to 
time to update the comments. Maintainers for a particular mode can also run it 
to update the comment themselves. And I’ll add more detailed documentation 
about how to use the script.

Yuan


reply via email to

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