Skip to content

Conversation

timsneath
Copy link
Contributor

@timsneath timsneath commented Mar 6, 2023

Adds a default workspace settings file for VSCode (one of the primary editors used by Flutter contributors) to ensure that it doesn't format on save by default while contributors are making changes to the Flutter repository.

It's frustratingly common that someone makes a good change, saves it, and then realizes to their horror that they have reformatted the entire class file. They then have to go through and revert the formatting changes while retaining the semantic changes they've made, a time-consuming and somewhat error-prone process. Adding this file to override the default VSCode settings will remove one tripwire for new contributors to the project.

Fixes #122050. This change should be test-exempt since it only adds a configuration file.

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide, including Features we expect every widget to implement.
  • I signed the CLA.
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is test-exempt.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@timsneath timsneath marked this pull request as ready for review March 6, 2023 21:39
@flutter-dashboard
Copy link

It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat (don't just cc him here, he won't see it! He's on Discord!).

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

@Hixie
Copy link
Contributor

Hixie commented Mar 14, 2023

test-exempt: configuration change

@timsneath timsneath requested a review from DanTup March 14, 2023 15:19
Copy link
Contributor

@DanTup DanTup left a comment

Choose a reason for hiding this comment

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

LGTM with a suggestion.

FWIW, I think this will only apply if you open up the repo root, and not just some individual packages (as I do, although I use a .code-workspace file that disables these).

I also think these aren't defaults in VS Code, but we do have them as "recommended settings" for Dart (so if you accept the prompt to use recommended settings on first run, they'll be added to your User Settings in the "[dart]" section). If we think this is the wrong thing, we can change it.

(it would perhaps also be nice if this could be set in a non-VS-Code specific way, although I don't have a good place in mind)

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.

Disable dart format on save for VSCode contributors
3 participants