tree-sitter-grammars / tree-sitter-query

TS query grammar for tree-sitter
Apache License 2.0
52 stars 14 forks source link

refactor!: rename list to alternation #39

Open amaanq opened 5 months ago

amaanq commented 5 months ago

Problem

In tree-sitter's query syntax, the construct described as a list in the current grammar is actually known as an alternation - see https://tree-sitter.github.io/tree-sitter/using-parsers#alternations

It would be better to rename this node to alternation, since it correctly captures what this node actually means in terms of the query syntax itself

Solution

Rename the node to alternation

clason commented 5 months ago

Note: this will break https://github.com/neovim/neovim/blob/2c6b6358722b2df9160c3739b0cea07e8779513f/runtime/lua/vim/treesitter/_query_linter.lua#L66-L78

Let me think whether it's possible to handle that gracefully -- right now, I don't see a way, in which case I don't think the more appropriate name is worth it.