Skip to content

fix: adjust scope created within multiline string W-21968889 - #85

Merged
peternhale merged 1 commit into
mainfrom
phale/fix-up-hoghlight-scopes
Apr 10, 2026
Merged

peternhale merged 1 commit into
mainfrom
phale/fix-up-hoghlight-scopes

Conversation

@peternhale

@peternhale peternhale commented Apr 9, 2026

Copy link
Copy Markdown
Contributor

Summary

Refines multiline string ('''…''') highlighting and template interpolation for single-quoted strings only, with tests and regenerated grammars (Apex + SOQL + Atom cson).

Multiline strings (multiline-string-literal)

  • Begin: '''(?=$) so the opening ''' must sit at end of line (matches the intended “newline after opener” behavior under line-based tokenization).
  • Scopes: compound string.quoted.single.apex + string.quoted.single.multiline.apex so themes color MLS body like normal string text.
  • Body: only #string-character-escape#string-template-expression is not included for MLS, so ${…} is not meta.template-expression; it uses the same string scopes as the rest of the MLS. Only backslash escapes get constant.character.escape.apex.

Simple strings (string-literal — unchanged structure)

  • Template begin: (?<!\\)\$\{ so \${…} is literal (escaped $), not a template opener.
  • Template interior: \G-anchored match supporting dotted names (e.g. ${a.b}) without splitting on ..

Other

  • when-string: include #multiline-string-literal before #string-literal in the relevant capture groups so MLS is available alongside single-quoted strings where those patterns are used.

Files

  • src/apex.tmLanguage.yml — grammar rules above.
  • grammars/apex.tmLanguage, grammars/apex.tmLanguage.cson, grammars/soql.tmLanguage — rebuilt outputs.
  • test/literals.test.ts — expectations for MLS (no template tokens inside '''…'''), escaped \$, dotted ${a.b} in simple strings, and updated MLS fixtures for EOL ''' opener.

Verify

  • npm run build && npm test

@W-21968889@

Modify multiline string so it uses the same highlight scopes found in simple string
@peternhale
peternhale requested a review from mshanemc April 9, 2026 19:53
@peternhale peternhale changed the title fix: adjust scope created within multiline string - W-21968889 [W-21968889] fix: adjust scope created within multiline string Apr 9, 2026
@peternhale peternhale changed the title [W-21968889] fix: adjust scope created within multiline string W-21968889: adjust scope created within multiline string Apr 9, 2026
@mshanemc mshanemc changed the title W-21968889: adjust scope created within multiline string fix: adjust scope created within multiline string W-21968889 Apr 10, 2026
@peternhale
peternhale merged commit 611becc into main Apr 10, 2026
18 of 22 checks passed
@peternhale
peternhale deleted the phale/fix-up-hoghlight-scopes branch April 10, 2026 14:59
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.

2 participants