Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

highlight(sql): Update tree-sitter-sql to 98a7fc9 #7387

Merged
merged 2 commits into from
Jun 19, 2023

Conversation

LeoniePhiline
Copy link
Contributor

@LeoniePhiline LeoniePhiline commented Jun 19, 2023

Changes:

Updates tree-sitter-sql from 3a3f92b29c880488a08bc2baaf1aca6432ec3380 to c5b1548ec95956c8da6393dceacf30aa349a6e9f.

Full grammar.js.

Note that to avoid further diff noise, the tree sitter JSON and C sources were moved onto the gh-pages branch.

This is why languages.toml references DerekStride/tree-sitter-sql@7cbac04 on the gh-pages branch, which contains the sources for DerekStride/tree-sitter-sql@98a7fc9 on the main branch (the latest grammar change on main).

Merged PRs:

(Solved) Issue with keyword_language

During review you might notice that (keyword_language) is commented out in line 210.

It seems to me like this query should work, but as long as this keyword query is enabled, helix fails parsing with:

helix_core::syntax [ERROR] Could not parse queries for language "sql". Are your grammars out of sync? Try running 'hx --grammar fetch' and 'hx --grammar build'. This query could not be parsed: QueryError { row: 209, column: 3, offset: 3657, message: "keyword_language", kind: NodeType }

This seems to be a TSQueryError from tree-sitter's C ts_query_new.

The symbol is defined in grammar.json.

But it is not defined in node-types.json.

In parser.c, it is defined as aux_sym_keyword_language_token1. 🤔 (see also the codegen)

(keyword_language) appears to be unused and thus declassified by the tree-sitter codegen to an auxiliary symbol.

Disabling (keyword_language) in the queries list is a viable workaround. I'd completely remove it if it is removed upstream.

@LeoniePhiline LeoniePhiline changed the title highlight(sql): Update tree-sitter-sql to 92018a3 highlight(sql): Update tree-sitter-sql to 92018a3 Jun 19, 2023
the-mikedavis
the-mikedavis previously approved these changes Jun 19, 2023
Copy link
Member

@the-mikedavis the-mikedavis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@the-mikedavis
Copy link
Member

Yeah as you noted in the issue it looks like that node is unused. When the tree-sitter C library checks the queries ("query analysis") it will reject patterns that can't possibly match. When it says that for named nodes that exist in the grammar.js it either means that the named node is unused like in this case or that it's used but always aliased to something else. So if a node can't appear in the syntax tree we'll see that error.

@the-mikedavis the-mikedavis added S-waiting-on-review Status: Awaiting review from a maintainer. A-language-support Area: Support for programming/text languages labels Jun 19, 2023
@LeoniePhiline
Copy link
Contributor Author

LeoniePhiline commented Jun 19, 2023

I'll add one more patch, since DerekStride/tree-sitter-sql#154 got fixed.

Yeah as you noted in the issue it looks like that node is unused. When the tree-sitter C library checks the queries ("query analysis") it will reject patterns that can't possibly match. When it says that for named nodes that exist in the grammar.js it either means that the named node is unused like in this case or that it's used but always aliased to something else. So if a node can't appear in the syntax tree we'll see that error.

Thanks!

@LeoniePhiline
Copy link
Contributor Author

LeoniePhiline commented Jun 19, 2023

I pushed e401a61 which only fixes a COUNT(DISTINCT tbl.field) bug and adds some CI.

I updated the PR title, description and hyperlinks to reflect the addition.

The referenced commit 7cbac0472e5b8f8486ce64ffbcf1982d5cd5fc8d in languages.toml is HEAD of the gh-pages branch, which contains the generated tree-sitter C code.

@LeoniePhiline LeoniePhiline changed the title highlight(sql): Update tree-sitter-sql to 92018a3 highlight(sql): Update tree-sitter-sql to 98a7fc9 Jun 19, 2023
Copy link
Member

@pascalkuthe pascalkuthe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@pascalkuthe pascalkuthe merged commit 48ad9ae into helix-editor:master Jun 19, 2023
wes-adams pushed a commit to wes-adams/helix that referenced this pull request Jul 4, 2023
* highlight(sql): Update tree-sitter-sql to 92018a3

* highlight(sql): Update tree-sitter-sql to 98a7fc9
@ds-cbo ds-cbo mentioned this pull request Oct 4, 2023
mtoohey31 pushed a commit to mtoohey31/helix that referenced this pull request Jun 2, 2024
* highlight(sql): Update tree-sitter-sql to 92018a3

* highlight(sql): Update tree-sitter-sql to 98a7fc9
smortime pushed a commit to smortime/helix that referenced this pull request Jul 10, 2024
* highlight(sql): Update tree-sitter-sql to 92018a3

* highlight(sql): Update tree-sitter-sql to 98a7fc9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-language-support Area: Support for programming/text languages S-waiting-on-review Status: Awaiting review from a maintainer.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants