Skip to content

[W-21481438] feat: add multiline string support for Apex grammar - #82

Merged
peternhale merged 3 commits into
mainfrom
phale/multiline-string
Mar 25, 2026
Merged

peternhale merged 3 commits into
mainfrom
phale/multiline-string

Conversation

@peternhale

Copy link
Copy Markdown
Contributor

Summary

Adds grammar support for Apex multiline strings ('''...''') and template expressions (${var}).

Changes

  • Grammar (apex.tmLanguage.yml)

    • New multiline-string-literal pattern (''' begin/end)
    • Updated string-literal so ''' is not parsed as single-quote ('(?!'') lookahead)
    • New string-template-expression for ${...} in single and multiline strings
  • Generated grammars

    • apex.tmLanguage, apex.tmLanguage.cson, soql.tmLanguage regenerated with the new rules
  • Tests (literals.test.ts)

    • Simple multiline string, template expressions, escaped characters
    • Method args, return values, SOQL WHERE, Map literals, throw, annotations, initializer blocks
    • Token types extended for multiline strings and template expressions
  • Repro fixtures

    • MultiLineString.cls and meta.xml for manual checks

@W-21481438@

@peternhale
peternhale requested a review from mshanemc March 16, 2026 17:47

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mshanemc why this test? The source is not valid.

[{
"resource": "/Users/peter.hale/git/dreamhouse-lwc-clean/force-app/main/default/classes/ManyInterfaces.cls",
"owner": "generated_diagnostic_collection_name#8",
"severity": 8,
"message": "Missing '' at 'public'",
"startLineNumber": 5,
"startColumn": 1,
"endLineNumber": 5,
"endColumn": 7,
"modelVersionId": 41,
"origin": "extHost1"
}]

@peternhale
peternhale merged commit a6834ea into main Mar 25, 2026
16 checks passed
@peternhale
peternhale deleted the phale/multiline-string branch March 25, 2026 18:42
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