Skip to content

Format ... (spread/rest) token - #168

Merged
TwitchBronBron merged 5 commits into
masterfrom
feat/dotdotdot-support
Oct 9, 2026
Merged

TwitchBronBron merged 5 commits into
masterfrom
feat/dotdotdot-support

Conversation

@iObject

@iObject iObject commented Oct 9, 2026

Copy link
Copy Markdown
Collaborator

Brighterscript now lexes ... as a single DotDotDot token, in preparation for spread and destructuring syntax. Update the formatter to handle it.

  • Remove whitespace between ... and its operand (... a -> ...a) for spread, rest parameters, and destructuring. Whitespace before a trailing comment is kept.
  • Fix curly brace spacing overwriting the token next to { or } when no whitespace token was present. Under the old lexer this turned {...a} into { ..a }.
  • Add tests for spread/rest/destructuring formatting and multi-line indentation.

Brighterscript now lexes `...` as a single DotDotDot token, in
preparation for spread and destructuring syntax. Update the formatter
to handle it.

- Remove whitespace between `...` and its operand (`... a` -> `...a`)
  for spread, rest parameters, and destructuring. Whitespace before a
  trailing comment is kept.
- Fix curly brace spacing overwriting the token next to `{` or `}`
  when no whitespace token was present. Under the old lexer this
  turned `{...a}` into `{ ..a }`.
- Add tests for spread/rest/destructuring formatting and multi-line
  indentation.
@iObject
iObject marked this pull request as ready for review October 9, 2026 19:03
@iObject
iObject requested a review from TwitchBronBron October 9, 2026 19:03
Comment thread src/formatters/InteriorWhitespaceFormatter.ts Outdated

@TwitchBronBron TwitchBronBron left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

looks great!

@TwitchBronBron TwitchBronBron changed the title feat: Support ... (spread/rest) token Format ... (spread/rest) token Oct 9, 2026
@TwitchBronBron
TwitchBronBron merged commit 8cce88c into master Oct 9, 2026
10 checks passed
@TwitchBronBron
TwitchBronBron deleted the feat/dotdotdot-support branch October 9, 2026 19:07
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