Skip to content

Commit

Permalink
vscode: Disable reformatting whole swaths of code
Browse files Browse the repository at this point in the history
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
  • Loading branch information
gnprice committed Jul 19, 2023
1 parent 7d673c2 commit 7dd4721
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Visual Studio Code settings for the zulip-flutter repo.
{
// VS Code formats files on save by default.
// Like Flutter itself, we don't use the Dart autoformatter,
// so disable that VS Code behavior.
"[dart]": {
// This appears redundant with the all-language setting,
// but it's not: if the user's personal config has a Dart-specific
// setting, then we need a Dart-specific setting to override it.
"editor.formatOnSave": false,
"editor.formatOnType": false,
"editor.formatOnPaste": false,
},

// For that matter, don't go reformatting whole files in any language.
"editor.formatOnSave": false,

// This much more focused automatic fix is helpful, though.
"files.trimTrailingWhitespace": true,
}

0 comments on commit 7dd4721

Please sign in to comment.