Replies: 3 comments
-
|
No, we don't have it for SQLX. Our lexer rules are here, what would be the effort to create this grammar from them? |
Beta Was this translation helpful? Give feedback.
-
|
I went ahead and experimented with a prototype grammar (using Claude Code) to see what's possible and what the challenges are: https://github.com/renzepost/tree-sitter-dataform What works:
However, there is a big limitation of this implementation. SQL statements aren't fully parsed, just tokenized and highlighted based on regex. A proper SQL grammar parses the syntactic structure of a query, not just the individual tokens. This enables things like detecting invalid SQL and autocompletion. I thought about injecting a SQL grammar like tree-sitter-sql-bigquery, but this means losing the ability to parse the I think to get parity with the lexer rules, the effort might not be that high, my experiment above already covers a lot. But to get full SQL parsing, one might need to fork an existing SQL grammar and expand it, which would be significantly more work, not to mention the maintenance burden. |
Beta Was this translation helpful? Give feedback.
-
|
Thanks! It's unlikely that we'll be able to support it ourselves in the near future, but we'll accept external contributions if someone is interested :) |
Beta Was this translation helpful? Give feedback.

Uh oh!
There was an error while loading. Please reload this page.
-
Does a tree-sitter grammar for Dataform
.sqlxexist? I searched for it but couldn't find anything. I think it would be a good foundation for syntax highlighting, linters, formatters, IDE extensions etcetera. Some reasons why I think it would be a good choice:config,js,pre_operations,post_operations${}interpolationsBeta Was this translation helpful? Give feedback.
All reactions