VS Code extension which is a wrapper for the Format Document command. It automatically indent to the correct level every empty lines after formatting the document.
The extension define a new command Format Document with implicit indent (format-with-implicit-indent.format
) which format the current document and apply implicit indentation.
This extension aims to solve an issue common to the majority of formatting utilities, i.e. removing the indentation from all the empty lines. This can be a very annoying inconvenience for developers who uses IDEs like VS Code, which don't work well when indents are stripped from empty lines, making navigation confusing. (See issue rust-lang/rustfmt#887)
The extension implicit-indent
already solves this issue in a clever way, by automatically adding indentation when cursor moves on empty lines.
My extension tries a different approach, by automatically adding indentation to all the empty lines of the document after formatting the document.
- Clone this repository.
- Install NodeJS and NPM.
- Install extension dependencies
sudo npm install -g @vscode/vsce npm install
- Build the extension
vsce package
- Install the extension
code --install-extension format-with-implicit-indent-0.0.1.vsix
I suggest configuring the IDE with the following setting:
"editor.trimAutoWhitespace": false
In this way, the editor will not automatically trim the whitespaces on empty lines (thus making this extension useless).
- Optimize indentation algorithm
- Prepare project for release on VS Code marketplace
- Documentation
- Configuration
- Reduce minimum required IDE version
- Release v1.0.0
- vscode-implicit-indent for the implicit indentation algorithm.