-
Notifications
You must be signed in to change notification settings - Fork 260
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Disable vscode autoformatting #229
Comments
A suggestion: The ideal solution would be not to disable the formating completely, but to let that IDE autoformat it in an acceptable way. I'm actually surprised that there is a format conflict here, doesn't VSCode with the flutter plugin just call dartfmt, and wouldn't dartfmts default be the best code style for this flutter project? |
Yeah. We don't use dartfmt, and instead use a style similar to what's in the Flutter repo itself: Our experience has been that
Discussion with more details here: The Flutter folks would like to use autoformatting too, and have had discussions for years with the Dart folks about making dartfmt work well for the Flutter style. I recently saw a mention that there might be progress happening on that, which would be great. |
The details here are largely borrowed from the Flutter repo, and in particular the subtleties most recently added there: flutter/flutter#122758 This config does the job in my testing. Note that it doesn't affect any of the things the editor does to simply augment your typing: adding indentation when you hit enter, adding a close-paren when you type an open-parent, and so on. Those are perfectly fine -- most of all because they only affect the code you actually intended to edit, but also because they generally get things right -- and continue operating as usual. Fixes: zulip#229
The details here are largely borrowed from the Flutter repo, and in particular the subtleties most recently added there: flutter/flutter#122758 This config does the job in my testing. Note that it doesn't affect any of the things the editor does to simply augment your typing: adding indentation when you hit enter, adding a close-paren when you type an open-parent, and so on. Those are perfectly fine -- most of all because they only affect the code you actually intended to edit, but also because they generally get things right -- and continue operating as usual. Fixes: #229
We've had a couple of contributors who use Visual Studio Code, and were frustrated by its eagerness to reformat entire files:
It should be possible to supply project-level config to VS Code to tell it not to do that, and we should put that config in the repo.
The PR #155 included a draft of such a config, which can be a starting point.
The text was updated successfully, but these errors were encountered: