tree-sitter-sql icon indicating copy to clipboard operation
tree-sitter-sql copied to clipboard

Adding suport for AUTOINCREMENT keyword from SQLite

Open andreRaposo91 opened this issue 1 year ago • 1 comments

When creating a table in SQLite, the AUTOINCREMENT keyword can be used as a column constraint when it is the primary key.

In the current implementation, this keyword does not exist, as the MySQL implementation uses AUTO_INCREMENT, with an underscore.

I'm new to Treesitter but I think it comes down to adding a new keyword in line 154

keyword_autoincrement: _ => make_keyword("autoincrement"),

and replacing line 2717 with a choice for the keywords in the _column_constraint function

choice($.keyword_auto_increment, $.keyword_autoincrement),

andreRaposo91 avatar Dec 13 '24 10:12 andreRaposo91

It's also possible to update the existing keyword_autoincrement to be a choice between the two options:

keyword_autoincrement: _ => choice(make_keyword("autoincrement"), make_keyword("autoincrement")),

DerekStride avatar Dec 13 '24 20:12 DerekStride