initial implementation for SQL syntax
Discussion for this implementation can be found at https://github.com/zed-industries/zed/discussions/7083
Release Notes:
- Adding syntax highlight for SQL
We require contributors to sign our Contributor License Agreement, and we don't have @eduardonunesp on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'.
This is looking great so far, with basic SQL syntax highlighting seeming to work. :-) Awesome work!
I don't have much experience with Treesitter, but can I ask what made you choose the currently referenced project over say https://github.com/DerekStride/tree-sitter-sql ? Not sure what the real differences are between implementations, just curious!
What's also really nice is that dbt, which uses Jinja syntax to build SQL models, also seems to work quite well too.
I had noticed a couple of syntax highlighting (with SQL, not Jinja) issues last week, but updating both Zed and this commit, it seems these issues are no longer appearing :tada:.
Given there are so many dialects/variants of SQL, and other language-specific "SQLisms", I believe having generic SQL syntax highlighting that supports the the majority, then having language specific implementations as needed would be great for this initial implementation.
Just look at how much work the sqlparser-rs project is!
I'll play with this further, and if I notice anything, I'll try create a Minimal Reproducible Example.
@joshuataylor thank you :)
I choose the current tree-sitter-sql implementation basically because it kind of worked at first try and compiled, despite some issues found as you can see above (I'm not much experienced on tree-sitter as well).
For sure the DerekStride implementation looks great too, I would like test it as well.
Well, there's a couple of small issues with Postgres syntax found right now, I've forked the tree-sitter-sql repo and working on it, I'm also willing to send a PR to the https://github.com/m-novikov/tree-sitter-sql tree-sitter-sql as well after this PR been accepted or not.
Yes, there're many "SQLisms", I'm trying to at least support MySQL, Postgres and SQL ISO. And I'm not sure if I can do this alone lol, as you pointer at sqlparser-rs it's a huge amount of work.
There had been another attempt to doing that via an extension: https://github.com/zed-industries/extensions/pull/103 and since it's a standalone thing outside of Zed sources, less strict requirements were applied to that.
Since extensions are now supporting the syntax highlights, I'm going to close this and propose to either improve the existing one, or create a new, better one — Zed repo is supposed to get most of its current language integrations converted into extensions in the end.
any contributions to https://github.com/evrsen/tree-sitter-sql would be appreciated :) some things that are not working which I'm aware of are comments highlighting and injections