Skip to content

fix: constants scope, CASCADE in TRUNCATE, keyword_ddl in PL/pgSQL bodies#5

Merged
vabatta merged 1 commit intomainfrom
fix/constants-cascade-keyword-ddl-in-plpgsql
Apr 4, 2026
Merged

fix: constants scope, CASCADE in TRUNCATE, keyword_ddl in PL/pgSQL bodies#5
vabatta merged 1 commit intomainfrom
fix/constants-cascade-keyword-ddl-in-plpgsql

Conversation

@vabatta
Copy link
Copy Markdown
Collaborator

@vabatta vabatta commented Apr 4, 2026

Summary

  • NULL/TRUE/FALSE/UNKNOWN not highlighted — scope was entity.name.label.pgsql (unstandardised, most themes don't style it); changed to constant.language.pgsql. Same fix applied to EXTRACT field names (EPOCH, YEAR, MONTH, etc.).
  • CASCADE/RESTRICT not highlighted in TRUNCATE — these were only in keyword_ddl, which dml_statement intentionally excludes to avoid false positives on column names; added them to keyword_dml instead.
  • Column names like output, value, data highlighted as DDL keywords inside PL/pgSQL function bodiesdollar_quotes was including keywords_all (which bundles keyword_ddl); replaced with explicit keyword_dml + keyword_control + keyword_other, matching the same rationale already applied to dml_statement.

Test plan

  • npm test — all 480 assertions pass
  • npm run validate — 0 unscoped tokens across all samples
  • npm run validate-sql — all statements parse via libpg-query
  • Visually verify in npm run preview: NULL/TRUE/FALSE highlighted as constants, CASCADE highlighted in TRUNCATE, output column name unstyled in PL/pgSQL INSERT

…dies

- Change NULL/TRUE/FALSE/UNKNOWN and EXTRACT field names from
  entity.name.label to constant.language so themes highlight them
- Add CASCADE and RESTRICT to keyword_dml so they highlight in
  TRUNCATE ... CASCADE/RESTRICT (previously only in keyword_ddl,
  which dml_statement intentionally excludes)
- Remove keyword_ddl from dollar_quotes context (PL/pgSQL function
  bodies); replace keywords_all with explicit keyword_dml +
  keyword_control + keyword_other — prevents column names like
  output, value, data from being highlighted as DDL keywords inside
  function bodies
@vabatta vabatta merged commit cbae1da into main Apr 4, 2026
1 check passed
@vabatta vabatta deleted the fix/constants-cascade-keyword-ddl-in-plpgsql branch April 4, 2026 23:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant