Merge 'Add syntax highlighting for EXPLAIN and ANALYZE' from Alex Miller

I'm working on ANALYZE.  I'm using EXPLAIN.  The lack of highlighting
for them in the CLI annoyed me a bit.
I don't think there's any tests for this?  I'm mostly at a "it seems to
work for me".  I double checked that `EXPLAIN SELECT CASE 0 WHEN 0 THEN
0 ELSE 1` syntax highlights, to make sure  I didn't break the longer
parsing (which I had).

Closes #2741
This commit is contained in:
Pekka Enberg
2025-08-23 10:51:31 +03:00
committed by GitHub

View File

@@ -11,7 +11,7 @@ variables:
simple_identifier_break: (?!\w)
toplevel_reserved: |-
(?xi: alter | create | cross | delete | drop | from | grant | group | inner | insert | join
(?xi: alter | analyze | create | cross | delete | drop | explain | from | grant | group | inner | insert | join
| left | on | order | outer | right | select | set | truncate | union
| update | where )
additional_toplevel_reserved: (?!)
@@ -75,6 +75,8 @@ contexts:
- include: dml-statements
- include: grant-statements
- include: revoke-statements
- include: explain-statements
- include: analyze-statements
- include: other-statements
###[ COMMENTS ]################################################################
@@ -560,6 +562,19 @@ contexts:
- meta_scope: meta.statement.revoke.sql
- include: immediately-pop
###[ EXPLAIN STATEMENTS ]######################################################
explain-statements:
- match: \b(?i:explain)\b
scope: keyword.other.ddl.sql
###[ ANALYZE STATEMENTS ]######################################################
analyze-statements:
- match: \b(?i:analyze)\b
scope: keyword.other.ddl.sql
set: expect-table-name
###[ OTHER STATEMENTS ]########################################################
other-statements: []