Skip to content

xnfo-dart/dart-polisher-vscode

Repository files navigation

VSCode Dart Polisher Extension

VScode Formatter


A code formatter for Dart.
Forked version from the official dart_style formatter.


Initial Configuration

Inside your settings.json

"[dart]": {
		"editor.defaultFormatter": "xnfo.dart-polisher",
		"editor.formatOnSave": true, // optional
		"editor.formatOnType": true, // optional
}

Works on ranges too.


Features

Uses editor indent sizes when formatting:

"[dart]": {
		"editor.tabSize": 4,
		"editor.insertSpaces": false // optional: use Tab as indent
}

The formatter internally works with space indents, dart-polisher.blockIndent or editor.tabSize will be used for tab conversion, in that order.


Unlocked indent sizes:

{
	// The number of spaces in a single level of expression nesting.
	"dart-polisher.expressionIndent": 4,

	// The number of spaces in a block or collection body.
	"dart-polisher.blockIndent": 4,

	// How much wrapped cascade sections indent.
	"dart-polisher.cascadeIndent": 4,

	// The ":" on a wrapped constructor initialization list.
	"dart-polisher.constructorInitializerIndent": 4
}

These are all defaulted to editor.tabSize if not set.

NOTE: when using tabs uneven indent sizes will be filled with spaces.


Code Styles

{
	// Dart style (default) is the original dart style
	//   but with customizable indent sizes.
	"dart-polisher.codeStyle": "Dart Style",

	// Expanded style is inspired by an outer braces style
	//   on block-like sintax. [beta]
	"dart-polisher.codeStyle": "Expanded Style",
}


Installation

Search for dart polisher in the VS Code Extension Marketplace and install it! or
Install latests vsix manually from Github Releases

Requirements

Works on Windows x64, Linux and Mac versions of VScode.
Compatible with web version of vscode

Known Issues

Beta version.

Release Notes

Please check CHANGELOG tab