Prettier More
Code formatter for Visual Studio Code using prettier-m.
This is a fork of prettier for VS Code. It is using prettier-m plugin and it gives more formatting options.
Supported languages:
Javascript, TypeScript, HTML, CSS, SCSS, JSON, YAML and more
Installation
It is possible to install it via VS Code extensions. Search for Prettier More - Code formatter .
Then you can open the JSON settings and add following lines:
{
"editor.defaultFormatter": "marbos.prettier-more",
"editor.formatOnSave": true
}
arrayBracketSpacing (defualt false) : add spaces between array
brackets
breakBeforeElse (default false) : add a line break before the else statement
breakLongMethodChains (default true) : break method chains with more than 3 method calls
indentChains (default false) : disable indents at the start of chained calls
Origin options
printWidth (default 120) : number of characters per line limit
tabWidth (default 2) : number of spaces per Tab
useTabs (default true) : indent by tabs instead of spaces
singleQuote (default true) : will use single quote instead of double one
jsxSingleQuote (default false) : settings applied for JSX files
trailingComma (default "es5") :
semi (default true) : it add a semicolon to the end of every statement
quoteProps (default "as-needed") : change when properties in objects are quoted
bracketSpacing (default true) : add spaces between brackets in object literals
bracketSameLine (default false) : put ending bracket '>' in the HTML to the same line as the last attribute is.
arrowParens (default "always") : add parentheses to arrow function (x) => x...
rangeStart (default 0) : position in file from formatting will start
rangeEnd (default Infinity) : number of characters from start position to formatting
parser (default None) : specify which parser will be used
filePath (default None) : specify file name to infer parser to use
requirePragma (default false) : restricts to format only files containing special comment
/**
* @prettier or @format
*/
insertPragma (default false) : if some file is formatted with prettier, it can insert pragma at the top of the file
proseWrap (default "preserve") : if always, it can wrap also markdown files and similar
htmlWhitespaceSensitivity (default "css") : whitespace sensitivity for HTML, Angular, Vue and Handlebars
vueIndentScriptAndStyle (default false) : sets indent the code inside of <script> and <style>
endOfLine (default "lf") : sets which endinig of line will be used in code editor
embeddedLanguageFormatting (default "auto") : sets if will be formatted quoted code in the file
singleAttributePerLine (_default false) : enforce single attribute per line in HTML, Vue and JSX.
| |