Frustrated by an opinionated formatter preventing me from working on my project on my own terms, I slapped this extension together. It adds a new shortcut "Format and Reindent" ctrl+shift+alt+f to format the file according to the formatter and then reindents it according to your settings
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Frustrated by an opinionated formatter preventing me from working on my project on my own terms, I slapped this extension together. It adds a new shortcut "Format and Reindent" ctrl + shift + alt + f to format the file according to the formatter and then reindents it according to your settings
Features
Format and Reindent (ctrl + shift + alt + f) : Formats the current file using its defined formatter, then reindents it according to your settings
Known Issues
Warning : This extension is a hack. Currently it uses the commands editor.action.indentationTo_ and editor.action.indentUsing_, the latter of which opens up a quick selection menu which has to programmatically be closed by selecting an item. A PR to VSCode's github could solve the problem by adding an argument to this command to let extension developpers choose the tabSize. Finally merging the onDidExecuteCommand would also help make this extension more seamless.
Currently forces ctrl + shift + alt + f as the default keybinding for the command on install. It is possible to change it after activation of the extension, but Id like to support other OS' default keybindings.
Does not work automatically, requires use of command as a replacement for the "Format Document" command.
Have found any other issue, or feel inclined to fix my garbage code ? Report it in the issues tab or create a PR, i'll check it out. Thanks.
Release Notes
0.0.1 - 2021-10-31
Initial release (Boo !)
0.0.2 - 2021-10-31
Added
A configuation value formatterTabSize, set by default to 2, helps fix "half-indentations" from being ignored by conversion
Changed
Use this new value in the extension to set the Editor tabSize prior to execution (but after the formatter has ran)