emacs-devel
[Top][All Lists]
Advanced

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

Re: Tree-sitter and major mode inheritance


From: Yuan Fu
Subject: Re: Tree-sitter and major mode inheritance
Date: Sat, 19 Nov 2022 13:49:50 -0800


> On Nov 19, 2022, at 1:39 PM, Dmitry Gutov <dgutov@yandex.ru> wrote:
> 
> On 19.11.2022 12:26, Eli Zaretskii wrote:
>>> From: Yuan Fu<casouri@gmail.com>
>>> Date: Sat, 19 Nov 2022 01:41:47 -0800
>>> Cc: Stefan Monnier<monnier@iro.umontreal.ca>,
>>>  Eli Zaretskii<eliz@gnu.org>,
>>>  Theodor Thornhill<theo@thornhill.no>
>>> 
>>> Anyway, does anyone think this is a good/bad idea? Should I go implement 
>>> this on css, js, c, etc? It can also be the other way around: instead of 
>>> having c-mode being the virtual mode, we can leave c-mode as-is, and have a 
>>> c-base-mode inherited by c-mode and c-ts-mode. And similarly rss-base-mode, 
>>> rss-mode, and rss-ts-mode.
>> I'd prefer leaving the original modes as-is.  That should cause less
>> compatibility problems, I think.
> 
> Eli, what's your solution for the problem, then?
> 
> E.g. js-mode enables tree-sitter, and installs some stuff based on it.
> 
> But js2-mode inherits from js-mode (meaning, it will run the same setup code, 
> and then some of its own), yet it has its own parser. Which will cause all 
> sorts of conflicts with tree-sitter.

Actually, that’s evidence supporting his preference: js-mode will remain to be 
the native implementation, so inheriting from it is exactly as before. 
Js-ts-mode will install tree-sitter stuff. And js-base-mode wouldn’t do much.


Yuan


reply via email to

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