feat: advanced SQL syntax highlighting and expanded language support#6
Merged
feat: advanced SQL syntax highlighting and expanded language support#6
Conversation
- Greatly expanded SQL keyword coverage (200+): LATERAL joins, GROUPING
SETS, CUBE, ROLLUP, MERGE, MATERIALIZED, transaction isolation levels,
DDL for functions/triggers/policies/extensions, PL/pgSQL control flow
- Added SQL built-in function recognition (250+) with distinct color:
aggregate functions, window functions, string/numeric/date functions,
JSON/JSONB functions, array functions, full-text search, system info
- Expanded SQL type coverage (90+): range types, multirange types, OID
types (regclass, regtype, etc.), full-text search types, pseudo-types
- Block comment (/* */) syntax highlighting with multi-line support
- PostgreSQL-specific operator highlighting: ::, ->, ->>, #>, #>>,
@>, <@, ?|, ?&, ||, and comparison operators
- Escaped single-quote ('') handling inside string literals
- Dot operator styled as muted for schema.table notation clarity
- Functions highlighted in distinct color (blue) vs keywords (purple)
Closes #4
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Keep is_sql_function from feature branch and tests from main. Fix duplicate entries in SQL_KEYWORDS (ONLY) and SQL_FUNCTIONS (GREATEST, LEAST, GENERATE_SERIES). Update tests for ROW_NUMBER being a function instead of a keyword, add function list tests. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Integrate the gutter marker for active query blocks from main while preserving the advanced SQL syntax highlighting from the feature branch. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Addresses the core syntax and language support goals from #4 to make pgrsql a power-user SQL editor with first-class support for modern PostgreSQL features:
WITH RECURSIVE), LATERAL joins, grouping sets (CUBE,ROLLUP,GROUPING SETS), transaction isolation levels, PL/pgSQL control flow (DECLARE,LOOP,RAISE,EXCEPTION), and DDL for functions, triggers, policies, extensions, and moreARRAY_AGG,STRING_AGG,PERCENTILE_CONT,JSON_AGG, etc.)ROW_NUMBER,RANK,DENSE_RANK,NTILE,LAG,LEAD,NTH_VALUE,CUME_DIST, etc.)JSONB_BUILD_OBJECT,JSONB_SET,JSONB_PATH_QUERY,ROW_TO_JSON, etc.)ARRAY_AGG,UNNEST,ARRAY_POSITION,CARDINALITY, etc.)INT4RANGE,TSTZRANGE), multirange, OID types (REGCLASS,REGTYPE), full-text search (TSVECTOR,TSQUERY), and pseudo-types/* */comments are properly highlighted, including across multiple lines::(type cast),->/->>(JSON),#>/#>>(JSON path),@>/<@(containment),?|/?&(JSONB existence),||(concatenation)''inside string literals no longer breaks highlighting.) styled as muted for cleanschema.tablereadabilitySyntax Color Scheme
SELECT,WITH RECURSIVE,LATERALROW_NUMBER(),JSONB_BUILD_OBJECT()TIMESTAMPTZ,JSONB,INT4RANGE'hello world'42,3.14-- comment,/* block */::,->>,@>Test plan
WITH,RECURSIVE,AS)ROW_NUMBER,DENSE_RANK,LAG)->,->>,@>,#>>)::type cast operator highlights/* ... */highlight across multiple lines''don't break string highlightingTSVECTOR,INT4RANGE,REGCLASShighlight in yellowARRAY_AGG,STRING_AGGhighlight in blueDECLARE,RAISE,LOOPhighlight🤖 Generated with Claude Code