Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update formatter settings #109

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 25 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,11 @@
"default": true,
"description": "Shows the last line of a folded section similar to the default VSCode folding style. When disabled, the entire folded region is hidden."
},
"powershell.codeFormatting.autoCorrectAliases": {
"type": "boolean",
"default": false,
"description": "Replaces aliases with their aliased name."
},
"powershell.codeFormatting.preset": {
"type": "string",
"enum": [
Expand Down Expand Up @@ -198,10 +203,11 @@
"enum": [
"IncreaseIndentationForFirstPipeline",
"IncreaseIndentationAfterEveryPipeline",
"NoIndentation"
"NoIndentation",
"None"
],
"default": "NoIndentation",
"description": "Multi-line pipeline style settings."
"description": "Multi-line pipeline style settings (default: NoIndentation)."
},
"powershell.codeFormatting.whitespaceBeforeOpenBrace": {
"type": "boolean",
Expand All @@ -228,10 +234,20 @@
"default": true,
"description": "Adds a space after an opening brace ('{') and before a closing brace ('}')."
},
"powershell.codeFormatting.whitespaceAroundPipe": {
"powershell.codeFormatting.whitespaceBetweenParameters": {
"type": "boolean",
"default": false,
"description": "Removes redundant whitespace between parameters."
},
"powershell.codeFormatting.addWhitespaceAroundPipe": {
"type": "boolean",
"default": true,
"description": "Adds a space before and after the pipeline operator ('|')."
"description": "Adds a space before and after the pipeline operator ('|') if it is missing."
},
"powershell.codeFormatting.trimWhitespaceAroundPipe": {
"type": "boolean",
"default": false,
"description": "Trims extraneous whitespace (more than 1 character) before and after the pipeline operator ('|')."
},
"powershell.codeFormatting.ignoreOneLineBlock": {
"type": "boolean",
Expand All @@ -243,6 +259,11 @@
"default": true,
"description": "Align assignment statements in a hashtable or a DSC Configuration."
},
"powershell.codeFormatting.useConstantStrings": {
"type": "boolean",
"default": false,
"description": "Use single quotes if a string is not interpolated and its value does not contain a single quote."
},
"powershell.codeFormatting.useCorrectCasing": {
"type": "boolean",
"default": false,
Expand Down
14 changes: 11 additions & 3 deletions src/client/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export interface ICodeFoldingSettings {
}

export interface ICodeFormattingSettings {
autoCorrectAliases: boolean;
preset: CodeFormattingPreset;
openBraceOnSameLine: boolean;
newLineAfterOpenBrace: boolean;
Expand All @@ -51,10 +52,13 @@ export interface ICodeFormattingSettings {
whitespaceBeforeOpenParen: boolean;
whitespaceAroundOperator: boolean;
whitespaceAfterSeparator: boolean;
whitespaceInsideBrace: true;
whitespaceAroundPipe: true;
whitespaceBetweenParameters: boolean;
whitespaceInsideBrace: boolean;
addWhitespaceAroundPipe: boolean;
trimWhitespaceAroundPipe: boolean;
ignoreOneLineBlock: boolean;
alignPropertyValuePairs: boolean;
useConstantStrings: boolean;
useCorrectCasing: boolean;
}

Expand Down Expand Up @@ -139,6 +143,7 @@ export function load(): ISettings {
};

const defaultCodeFormattingSettings: ICodeFormattingSettings = {
autoCorrectAliases: false,
preset: CodeFormattingPreset.Custom,
openBraceOnSameLine: true,
newLineAfterOpenBrace: true,
Expand All @@ -148,10 +153,13 @@ export function load(): ISettings {
whitespaceBeforeOpenParen: true,
whitespaceAroundOperator: true,
whitespaceAfterSeparator: true,
whitespaceBetweenParameters: false,
whitespaceInsideBrace: true,
whitespaceAroundPipe: true,
addWhitespaceAroundPipe: true,
trimWhitespaceAroundPipe: false,
ignoreOneLineBlock: true,
alignPropertyValuePairs: true,
useConstantStrings: false,
useCorrectCasing: false,
};

Expand Down