emacs-devel
[Top][All Lists]
Advanced

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

Re: Update on tree-sitter structure navigation


From: Yuan Fu
Subject: Re: Update on tree-sitter structure navigation
Date: Thu, 7 Sep 2023 18:04:02 -0700


> On Sep 2, 2023, at 5:56 PM, Dmitry Gutov <dgutov@yandex.ru> wrote:
> 
> Hi Yuan,
> 
> On 02/09/2023 08:01, Yuan Fu wrote:
>> - Solve the grammar versioning/breaking-change problem: tree-sitter grammar 
>> don’t have a version number, so every time the author changes the grammar, 
>> our queries break, and loading the mode only produces a giant error.
> 
> I don't have a better idea than basically copying NeoVim and others: to 
> maintain the urls to parser repositories and the ref of the latest known good 
> revision, for the current version of the major mode. That info could be 
> filled in by major modes themselves, e.g. in an autoload block (similarly to 
> how auto-mode-alist is appended to).

That’ll probably be ideal for third-party modes. But knowing Eli, I don’t think 
builtin major modes can do that.

> 
>> Finally, feel free to send me an email or send to emacs-devel and CC me, if 
>> there are things treesit.c and treesit.el can do better, or when there are 
>> nice things in neovim and other editors and Emacs ought to have, too.
> 
> Something I mentioned previously, there is notion of scopes in tree-sitter 
> docs, see the Local Variables section here: 
> https://tree-sitter.github.io/tree-sitter/syntax-highlighting#local-variables
> 
> Basically to know which symbols are defined and for how long, the parser 
> needs additional help from the major mode author.
> 
> Neovim's definition here: 
> https://github.com/nvim-treesitter/nvim-treesitter/blob/master/queries/ruby/locals.scm

Good call. I’ll add it to my TODO list, but it’ll have a lower priority, since 
I personally aren’t really interested in coloring variables different colors. 
If someone is interested, do please give it a try.

Yuan


reply via email to

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