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

SQL highlighting fails for INSERT ... SET, INSERT ... VALUES with multiple records, and GROUP_CONCAT with SEPARATOR #5186

Closed
LeoniePhiline opened this issue Dec 16, 2022 · 5 comments · Fixed by #5683
Labels
A-language-support Area: Support for programming/text languages A-tree-sitter Area: Tree-sitter C-bug Category: This is a bug

Comments

@LeoniePhiline
Copy link
Contributor

LeoniePhiline commented Dec 16, 2022

Summary

Example SQL:

INSERT INTO ... SET ... syntax:

INSERT INTO some_table
  field = "String does not get highlight in INSERT SET syntax";

helix 22.12: String value does not get highlight:

image

INSERT INTO ... (...) VALUES (...) syntax with multiple values records:

INSERT INTO some_table
  (field)
VALUES
  ("String value"),
  ("String value");

helix 22.12: Values of second record do not get highlight:

image

GROUP_CONCAT with SEPARATOR:

SELECT GROUP_CONCAT(uid SEPARATOR ",") 
FROM some_table 
GROUP BY some_field;

SELECT GROUP_CONCAT(uid SEPARATOR ",") 
FROM some_table 
GROUP BY some_field;

helix 22.12: Separator string appears to not be expected (only "," should be yellow):

image

Theme for all screenshots: monokai_pro_spectrum

Reproduction Steps

I tried this:

Typed the above SQL queries (MySQL dialect) into helix.

Alternatively, copy-paste and use :set-language sql or write to an *.sql file.

I expected this to happen:

Proper highlighting (see GitHub highlight above).

Instead, this happened:

Erratic highlighting (see helix screenshots above).

Helix log

(nothing relevant in the helix log)

Platform

openSUSE Tumbleweed

Terminal Emulator

konsole

Helix Version

22.12

@LeoniePhiline LeoniePhiline added the C-bug Category: This is a bug label Dec 16, 2022
@LeoniePhiline LeoniePhiline changed the title SQL highlighting fails with some LIKE + % combinations SQL highlighting fails with some LIKE + % combinations as well as GROUP_CONCAT with SEPARATOR Dec 16, 2022
@LeoniePhiline LeoniePhiline changed the title SQL highlighting fails with some LIKE + % combinations as well as GROUP_CONCAT with SEPARATOR SQL highlighting fails for INSERT ... SET, INSERT ... VALUES with multiple records, and GROUP_CONCAT with SEPARATOR Dec 16, 2022
@pascalkuthe pascalkuthe added A-tree-sitter Area: Tree-sitter A-language-support Area: Support for programming/text languages labels Dec 17, 2022
@archseer
Copy link
Member

I'd start by upgrading https://github.com/DerekStride/tree-sitter-sql to the latest revision. If that doesn't fix it it'll need to be reported upstream

@pascalkuthe
Copy link
Member

#5071 is possibly related. Although the issue itself is very different the issue was solved by upgrading the parser. Perhaohs that helps here aswell as the current version is known to be buggy

@LeoniePhiline
Copy link
Contributor Author

Notably, like mentioned in #5071 I also experienced terrible input delays (hangs in insert mode) while working on an SQL file of only a few kilobytes. (Containing variants of the mis-highlighted syntax extracted above.)

@LeoniePhiline
Copy link
Contributor Author

I tested with helix latest master and updated tree-sitter-sql to latet master as well (+ grammar fetch & build).
However, this lead to no improvements.

I reported the issue upstream at DerekStride/tree-sitter-sql#67

@LeoniePhiline
Copy link
Contributor Author

There is another weird behavior. Do you guys see this as a possible helix bug? The effect is unstable and highlighting switches between correct and incorrect just by e.g. adding white space characters or doing other non-syntax editing.

I described it in DerekStride/tree-sitter-sql#67 (comment)

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 A-tree-sitter Area: Tree-sitter C-bug Category: This is a bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants