Skip to content

Commit 2da776d

Browse files
gnpricechrisbobbe
authored andcommitted
vscode: Disable reformatting whole swaths of code
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
1 parent 7d673c2 commit 2da776d

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

.vscode/settings.json

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Visual Studio Code settings for the zulip-flutter repo.
2+
{
3+
// VS Code formats files on save by default.
4+
// Like Flutter itself, we don't use the Dart autoformatter,
5+
// so disable that VS Code behavior.
6+
"[dart]": {
7+
// This appears redundant with the all-language setting,
8+
// but it's not: if the user's personal config has a Dart-specific
9+
// setting, then we need a Dart-specific setting to override it.
10+
"editor.formatOnSave": false,
11+
"editor.formatOnType": false,
12+
"editor.formatOnPaste": false,
13+
},
14+
15+
// For that matter, don't go reformatting whole files in any language.
16+
"editor.formatOnSave": false,
17+
18+
// This much more focused automatic fix is helpful, though.
19+
"files.trimTrailingWhitespace": true,
20+
}

0 commit comments

Comments
 (0)