Skip to content

Conversation

0xrusowsky
Copy link
Contributor

@0xrusowsky 0xrusowsky commented Oct 2, 2025

Motivation

closes #8557

Solution

since we ended up deciding that it was better for solar to use a new SpannedOption<T> which only added the position of uninformed elements, rather than Spanned<T> that would wrap both Some(T) + None and inform their surrounding separators, the fix introduces a workaround that:

  1. peeks at a comment before the next item
  2. checks if the span from the cursor to the cmnt is disabled
  3. gets the snippet from the sourcemap and checks if it has any commas

NOTE: i know we shouldn't rely on the sm, but imo the workaround is acceptable, as this path seems quite unlikely to be triggered frequently

PR Checklist

  • Added Tests
  • Added Documentation
  • Breaking changes

@DaniPopes DaniPopes changed the title fix(fmt): preserve cmnt possition in disabled lines fix(fmt): preserve comment position in disabled lines Oct 2, 2025
@onbjerg onbjerg merged commit 068791e into master Oct 2, 2025
16 checks passed
@onbjerg onbjerg deleted the rusowsky/8557 branch October 2, 2025 22:11
@github-project-automation github-project-automation bot moved this to Done in Foundry Oct 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

bug(forge fmt): ignores forgefmt: disable-next-line in argument lists
3 participants