m-novikov / tree-sitter-sql

SQL syntax highlighting for tree-sitter
MIT License
112 stars 33 forks source link

Improve from clause #43

Closed pplam closed 1 year ago

pplam commented 2 years ago

Improved the FROM clause in SELECT statement to make it more general, ref: https://www.postgresql.org/docs/current/sql-select.html#SQL-FROM

pplam commented 2 years ago

@m-novikov This PR is depend on PR#41, please merge PR#41 first

m-novikov commented 2 years ago

Sorry have little time these days. I'll merge https://github.com/m-novikov/tree-sitter-sql/pull/63 first so I can actually comment on PRs, this would need rebase. I also disagree with changes to alliases: For example:

@@ -104,13 +104,13 @@ SELECT a, b AS c FROM table1 AS t;
   (select_statement
     (select_clause
       (select_clause_body
+        (identifier)
         (identifier)
         (alias
-          (identifier)
           (identifier))))
     (from_clause
+      (identifier)
       (alias
-        (identifier)
         (identifier)))))

When using expand selection used on aliased expression I would expect it to select b AS c but with the current structure, it doesn't seem to be possible.