From c708b68c0a9f3e1e47440ad79591b2b50fdce931 Mon Sep 17 00:00:00 2001
From: "Anantachai Saothong (Manta)" The below is a JSON containing the default formatting options. The prefix Insert or remove a colon between a property name and its value. Insert or remove a semi-colon after a property value, a variable declaration, a variable assignment and a mixin/function call. Insert or remove a pair of curly braces where they are supposed to be. Note that this option does not affect Insert a new-line around a group of Only apply to imports outside a block when set to Check the detailed examples below. Insert a new-line around blocks. Only apply to top-level blocks when set to Check the detailed examples below. Insert a new-line around a group of CSS properties. Unlike insertNewLineAroundBlocks and insertNewLineAroundOthers, this option cannot be set to Check the detailed examples below. Insert a new-line around a group of non-properties, non-imports and non-blocks. Only apply to others outside a block when set to Check the detailed examples below. Insert or remove a new-line between selectors. Insert or remove a white-space before a comment. Insert or remove a white-space after a comment. Insert or remove a white-space after a comma. Insert or remove a white-space after an open parenthesis and before a close parenthesis. Insert a pair of parentheses or a white-space after a negation operator. This does nothing if a pair of parentheses is already after the negation operator. Insert or remove a pair of parentheses around Insert or remove a new-line before Insert or remove a zero before a number that between 1 and 0. Represent an indentation. You may change this to any sequence of white-spaces. This option is not available in the Visual Studio Code extension. Represent a new-line character. You may want to change this to This option is not available in the Visual Studio Code extension. Represent a quote character that is used to begin and terminate a string. You must choose either a single-quote or a double-quote. Can be either Formatting options
stylusSupremacy.
was added since version 2.4, and because of that, passing .vscode/settings.json
as an argument of --options
is possible, but you can omit them for backward compatibility.{
"stylusSupremacy.insertColons": true,
"stylusSupremacy.insertSemicolons": true,
"stylusSupremacy.insertBraces": true,
"stylusSupremacy.insertNewLineAroundImports": true,
"stylusSupremacy.insertNewLineAroundBlocks": true,
"stylusSupremacy.insertNewLineAroundProperties": false,
"stylusSupremacy.insertNewLineAroundOthers": false,
"stylusSupremacy.insertNewLineBetweenSelectors": false,
"stylusSupremacy.insertSpaceBeforeComment": true,
"stylusSupremacy.insertSpaceAfterComment": true,
"stylusSupremacy.insertSpaceAfterComma": true,
"stylusSupremacy.insertSpaceInsideParenthesis": false,
"stylusSupremacy.insertParenthesisAfterNegation": false,
"stylusSupremacy.insertParenthesisAroundIfCondition": true,
"stylusSupremacy.insertNewLineBeforeElse": false,
"stylusSupremacy.insertLeadingZeroBeforeFraction": true,
"stylusSupremacy.tabStopChar": "\t",
"stylusSupremacy.newLineChar": "\n",
"stylusSupremacy.quoteChar": "'",
"stylusSupremacy.sortProperties": false,
"stylusSupremacy.alwaysUseImport": false,
"stylusSupremacy.alwaysUseNot": false,
"stylusSupremacy.alwaysUseAtBlock": false,
"stylusSupremacy.alwaysUseExtends": false,
"stylusSupremacy.alwaysUseNoneOverZero": false,
"stylusSupremacy.alwaysUseZeroWithoutUnit": false,
"stylusSupremacy.reduceMarginAndPaddingValues": false
}insert
= true
: boolean
background: red;
}
background red;
}
background: red;
}
background red;
}insert
= true
: boolean
background: red;
}
background: red
}
background: red;
}
background: red
}insert
= true
: boolean
@block
construction, see alwaysUseAtBlock.
background: red;
}
background: red;
background: red;
}
background: red;insert
= true
: true | false | "root" | "nested"
@import
/@require
(s)."root"
, or only apply to imports inside a block when set to "nested"
.insert
= true
: true | false | "root" | "nested"
"root"
, or only apply to nested blocks when set to "nested"
.insert
= false
: boolean
"root"
nor "nested"
because CSS properties cannot be placed at the top level.insert
= false
: true | false | "root" | "nested"
"root"
, or only apply to others inside a block when set to "nested"
.insert
= false
: boolean
.class2 {
background: red;
}
background: red;
}
.class2 {
background: red;
}
background: red;
}insert
= true
: boolean
background: red; // comment
}
background: red;// comment
}
background: red; // comment
}
background: red;// comment
}insert
= true
: boolean
background: red; // comment
}
background: red; //comment
}
background: red; // comment
}
background: red; //comment
}insert
= true
: boolean
margin: a b;
}
margin: a b;
}
margin: a b;
}
margin: a b;
}insert
= false
: boolean
margin: a b;
}
margin: a b;
}
margin: a b;
}
margin: a b;
}insert
= false
: boolean
top: -(10px);
left: -(10px);
}
top: - 10px;
left: -(10px);
}
top: -(10px);
left: -(10px);
}
top: - 10px;
left: -(10px);
}insert
= true
: boolean
if
-condition.
background: red;
}
background: red;
}
background: red;
}
background: red;
}insert
= false
: boolean
else
keyword.
background: red;
}
else {
background: blue;
}
background: red;
} else {
background: blue;
}
background: red;
}
else {
background: blue;
}
background: red;
} else {
background: blue;
}insert
= true
: boolean
margin: 0.5px;
}
margin: .5px;
}
margin: 0.5px;
}
margin: .5px;
}tab
= "\t"
: string
new
= "\n"
: "\n" | "\r\n"
"\r\n"
for Microsoft Windows.quote
= "'"
: "'" | "\""
font-family: 'Open Sans';
}
font-family: "Open Sans";
}
font-family: 'Open Sans';
}
font-family: "Open Sans";
}sort
= false
: false | "alphabetical" | "grouped" | array<string>
false
for not sorting, "alphabetical"
for sorting CSS properties from A to Z, "grouped"
for sorting CSS properties according to Stylint and nib -- click here to show the full list of sorted properties, or an array of property names that defines the property order, for example ["color", "background", "display"]
.
= false
: boolean
Replace @require
with @import
, or do nothing.
= false
: boolean
Replace !
operator with not
keyword, or vice versa.
= false
: boolean
Replace an increased-indent at-block construction with an explicit one with @block
keyword or vice versa.
Note that this option does not incorporate insertBraces option.
= false
: boolean
Convert @extend
keyword to @extends
keyword, or vice versa.
= false
: boolean
Replace 0
(regardless of its unit) with none
for border
and outline
properties, or do nothing.
= false
: boolean
Replace 0
(regardless of its unit) with 0
(without units), or do nothing.
= false
: boolean
Reduce margin
and padding
duplicate values by converting margin x x x x
to margin x
, margin x y x y
to margin x y
, and margin x y y y
to margin x y y
where x
, y
is a unique property value.
{
"stylusSupremacy.insertColons ": true,
"stylusSupremacy.insertSemicolons ": true,
"stylusSupremacy.insertBraces ": true,
"stylusSupremacy.insertNewLineAroundImports ": true,
"stylusSupremacy.insertNewLineAroundBlocks ": true,
"stylusSupremacy.insertNewLineAroundProperties ": false,
"stylusSupremacy.insertNewLineAroundOthers ": false,
"stylusSupremacy.insertNewLineBetweenSelectors ": false,
"stylusSupremacy.insertSpaceBeforeComment ": true,
"stylusSupremacy.insertSpaceAfterComment ": true,
"stylusSupremacy.insertSpaceAfterComma ": true,
"stylusSupremacy.insertSpaceInsideParenthesis ": false,
"stylusSupremacy.insertParenthesisAfterNegation ": false,
"stylusSupremacy.insertParenthesisAroundIfCondition ": true,
"stylusSupremacy.insertNewLineBeforeElse ": false,
"stylusSupremacy.insertLeadingZeroBeforeFraction ": true,
"stylusSupremacy.tabStopChar ": "\t",
"stylusSupremacy.newLineChar ": "\n",
"stylusSupremacy.quoteChar ": "'",
"stylusSupremacy.sortProperties ": false,
"stylusSupremacy.alwaysUseImport ": false,
"stylusSupremacy.alwaysUseNot ": false,
"stylusSupremacy.alwaysUseAtBlock ": false,
"stylusSupremacy.alwaysUseExtends ": false,
"stylusSupremacy.alwaysUseNoneOverZero ": false,
"stylusSupremacy.alwaysUseZeroWithoutUnit ": false,
"stylusSupremacy.reduceMarginAndPaddingValues ": false
}
= true
: boolean
Insert or remove a colon between a property name and its value.
= true
: boolean
Insert or remove a semi-colon after a property value, a variable declaration, a variable assignment and a mixin/function call.
= true
: boolean
Insert or remove a pair of curly braces where they are supposed to be. Note that this option does not affect @block
construction, see alwaysUseAtBlock.
= true
: true | false | "root" | "nested"
Insert a new-line around a group of @import
/@require
(s).
Only apply to imports outside a block when set to "root"
, or only apply to imports inside a block when set to "nested"
.
Check the detailed examples below.
= true
: true | false | "root" | "nested"
Insert a new-line around blocks.
Only apply to top-level blocks when set to "root"
, or only apply to nested blocks when set to "nested"
.
Check the detailed examples below.
= false
: boolean
Insert a new-line around a group of CSS properties.
Unlike insertNewLineAroundBlocks and insertNewLineAroundOthers, this option cannot be set to "root"
nor "nested"
because CSS properties cannot be placed at the top level.
Check the detailed examples below.
= false
: true | false | "root" | "nested"
Insert a new-line around a group of non-properties, non-imports and non-blocks.
Only apply to others outside a block when set to "root"
, or only apply to others inside a block when set to "nested"
.
Check the detailed examples below.
= false
: boolean
Insert or remove a new-line between selectors.
= true
: boolean
Insert or remove a white-space before a comment.
= true
: boolean
Insert or remove a white-space after a comment.
= true
: boolean
Insert or remove a white-space after a comma.
= false
: boolean
Insert or remove a white-space after an open parenthesis and before a close parenthesis.
= false
: boolean
Insert a pair of parentheses or a white-space after a negation operator. This does nothing if a pair of parentheses is already after the negation operator.
= true
: boolean
Insert or remove a pair of parentheses around if
-condition.
= false
: boolean
Insert or remove a new-line before else
keyword.
= true
: boolean
Insert or remove a zero before a number that between 1 and 0.
= "\t"
: string
Represent an indentation. You may change this to any sequence of white-spaces.
This option is not available in the Visual Studio Code extension.
= "\n"
: "\n" | "\r\n"
Represent a new-line character. You may want to change this to "\r\n"
for Microsoft Windows.
This option is not available in the Visual Studio Code extension.
= "'"
: "'" | "\""
Represent a quote character that is used to begin and terminate a string. You must choose either a single-quote or a double-quote.
= false
: false | "alphabetical" | "grouped" | array<string>
Can be either false
for not sorting, "alphabetical"
for sorting CSS properties from A to Z, "grouped"
for sorting CSS properties according to Stylint and nib -- click here to show the full list of sorted properties, or an array of property names that defines the property order, for example ["color", "background", "display"]
.
= false
: boolean
Replace @require
with @import
, or do nothing.
= false
: boolean
Replace !
operator with not
keyword, or vice versa.
= false
: boolean
Replace an increased-indent at-block construction with an explicit one with @block
keyword or vice versa.
Note that this option does not incorporate insertBraces option.
= false
: boolean
Convert @extend
keyword to @extends
keyword, or vice versa.
= false
: boolean
Replace 0
(regardless of its unit) with none
for border
and outline
properties, or do nothing.
= false
: boolean
Replace 0
(regardless of its unit) with 0
(without units), or do nothing.
= false
: boolean
Reduce margin
and padding
duplicate values by converting margin x x x x
to margin x
, margin x y x y
to margin x y
, and margin x y y y
to margin x y y
where x
, y
is a unique property value.
insertNewLineAroundImports, insertNewLineAroundBlocks, insertNewLineAroundProperties and insertNewLineAroundOthers are meant to be configured together. First of all, you have to understand what is what.
@@ -443,5 +443,19 @@This package only supports reading formatting options from .stylintrc file and in-package Format on Save setting. Please find an example of .stylintrc file in Stylint compatibility section.
+