From 0ba94a1959ad5185b6f1aa40b5012180e1e655f4 Mon Sep 17 00:00:00 2001 From: Tyler Leonhardt Date: Sun, 30 Aug 2020 20:37:25 -0700 Subject: [PATCH] Update formatter settings --- package-lock.json | 18 +++++++++--------- package.json | 29 +++++++++++++++++++++++++---- src/client/settings.ts | 14 +++++++++++--- 3 files changed, 45 insertions(+), 16 deletions(-) diff --git a/package-lock.json b/package-lock.json index a823b97..5a60fd4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "coc-powershell", - "version": "0.1.2", + "version": "0.1.3", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -59,7 +59,7 @@ }, "buffer-crc32": { "version": "0.2.13", - "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz", + "resolved": "https://botbuilder.myget.org/F/botframework-cli/npm/buffer-crc32/-/buffer-crc32-0.2.13.tgz", "integrity": "sha1-DTM+PwDqxQqhRUq9MO+MKl2ackI=" }, "buffer-from": { @@ -148,7 +148,7 @@ }, "core-util-is": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "resolved": "https://botbuilder.myget.org/F/botframework-cli/npm/core-util-is/-/core-util-is-1.0.2.tgz", "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" }, "date-format": { @@ -204,7 +204,7 @@ }, "ms": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "resolved": "https://botbuilder.myget.org/F/botframework-cli/npm/ms/-/ms-2.0.0.tgz", "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" } } @@ -226,7 +226,7 @@ }, "fd-slicer": { "version": "1.1.0", - "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz", + "resolved": "https://botbuilder.myget.org/F/botframework-cli/npm/fd-slicer/-/fd-slicer-1.1.0.tgz", "integrity": "sha1-JcfInLH5B3+IkbvmHY85Dq4lbx4=", "requires": { "pend": "~1.2.0" @@ -500,7 +500,7 @@ }, "pend": { "version": "1.2.0", - "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz", + "resolved": "https://botbuilder.myget.org/F/botframework-cli/npm/pend/-/pend-1.2.0.tgz", "integrity": "sha1-elfrVQpng/kRUzH89GY9XI4AelA=" }, "process-nextick-args": { @@ -644,7 +644,7 @@ }, "typedarray": { "version": "0.0.6", - "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", + "resolved": "https://botbuilder.myget.org/F/botframework-cli/npm/typedarray/-/typedarray-0.0.6.tgz", "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=" }, "typescript": { @@ -661,7 +661,7 @@ }, "util-deprecate": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "resolved": "https://botbuilder.myget.org/F/botframework-cli/npm/util-deprecate/-/util-deprecate-1.0.2.tgz", "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" }, "uuid": { @@ -717,7 +717,7 @@ }, "yauzl": { "version": "2.10.0", - "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.10.0.tgz", + "resolved": "https://botbuilder.myget.org/F/botframework-cli/npm/yauzl/-/yauzl-2.10.0.tgz", "integrity": "sha1-x+sXyT4RLLEIb6bY5R+wZnt5pfk=", "requires": { "buffer-crc32": "~0.2.3", diff --git a/package.json b/package.json index f8f10d4..dc60a06 100644 --- a/package.json +++ b/package.json @@ -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": [ @@ -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", @@ -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", @@ -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, diff --git a/src/client/settings.ts b/src/client/settings.ts index 05d6674..39a76e3 100644 --- a/src/client/settings.ts +++ b/src/client/settings.ts @@ -42,6 +42,7 @@ export interface ICodeFoldingSettings { } export interface ICodeFormattingSettings { + autoCorrectAliases: boolean; preset: CodeFormattingPreset; openBraceOnSameLine: boolean; newLineAfterOpenBrace: boolean; @@ -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; } @@ -139,6 +143,7 @@ export function load(): ISettings { }; const defaultCodeFormattingSettings: ICodeFormattingSettings = { + autoCorrectAliases: false, preset: CodeFormattingPreset.Custom, openBraceOnSameLine: true, newLineAfterOpenBrace: true, @@ -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, };