mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 21:09:43 +00:00
Expose insert..Braces rule in VS Code settings (#21649)
* Expose insert..Braces rule in VS Code settings Fixes #18043 * Add requirement blurb for insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces * Revert tsfmt change
This commit is contained in:
parent
eb6614a16d
commit
95f0c15bf5
|
@ -228,6 +228,7 @@ function format(text:string): string {
|
|||
insertSpaceAfterFunctionKeywordForAnonymousFunctions: false,
|
||||
insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: false,
|
||||
insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets: false,
|
||||
insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces: true,
|
||||
insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces: true,
|
||||
placeOpenBraceOnNewLineForFunctions: false,
|
||||
placeOpenBraceOnNewLineForControlBlocks: false,
|
||||
|
|
|
@ -365,6 +365,7 @@ function convertOptions(options: FormattingOptions, formatSettings: any, initial
|
|||
InsertSpaceAfterFunctionKeywordForAnonymousFunctions: Boolean(!formatSettings || formatSettings.insertSpaceAfterFunctionKeywordForAnonymousFunctions),
|
||||
InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: Boolean(formatSettings && formatSettings.insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis),
|
||||
InsertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets: Boolean(formatSettings && formatSettings.insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets),
|
||||
InsertSpaceAfterOpeningAndBeforeClosingNonemptyBraces: Boolean(formatSettings && formatSettings.insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces),
|
||||
InsertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces: Boolean(formatSettings && formatSettings.insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces),
|
||||
PlaceOpenBraceOnNewLineForControlBlocks: Boolean(formatSettings && formatSettings.placeOpenBraceOnNewLineForFunctions),
|
||||
PlaceOpenBraceOnNewLineForFunctions: Boolean(formatSettings && formatSettings.placeOpenBraceOnNewLineForControlBlocks)
|
||||
|
|
|
@ -191,6 +191,11 @@
|
|||
"default": false,
|
||||
"description": "%format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets%"
|
||||
},
|
||||
"typescript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces": {
|
||||
"type": "boolean",
|
||||
"default": false,
|
||||
"description": "%format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces%"
|
||||
},
|
||||
"typescript.format.insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces": {
|
||||
"type": "boolean",
|
||||
"default": false,
|
||||
|
@ -261,6 +266,11 @@
|
|||
"default": false,
|
||||
"description": "%format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets%"
|
||||
},
|
||||
"javascript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces": {
|
||||
"type": "boolean",
|
||||
"default": false,
|
||||
"description": "%format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces%"
|
||||
},
|
||||
"javascript.format.insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces": {
|
||||
"type": "boolean",
|
||||
"default": false,
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
"format.insertSpaceBeforeFunctionParenthesis": "Defines space handling before function argument parentheses. Requires TypeScript >= 2.1.5.",
|
||||
"format.insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis": "Defines space handling after opening and before closing non empty parenthesis.",
|
||||
"format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets": "Defines space handling after opening and before closing non empty brackets.",
|
||||
"format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces": "Defines space handling after opening and before closing non empty braces. Requires TypeScript >= 2.3.0.",
|
||||
"format.insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces": "Defines space handling after opening and before closing template string braces. Requires TypeScript >= 2.0.6.",
|
||||
"format.insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces": "Defines space handling after opening and before closing JSX expression braces. Requires TypeScript >= 2.0.6.",
|
||||
"format.placeOpenBraceOnNewLineForFunctions": "Defines whether an open brace is put onto a new line for functions or not.",
|
||||
|
|
|
@ -19,6 +19,7 @@ interface Configuration {
|
|||
insertSpaceAfterFunctionKeywordForAnonymousFunctions: boolean;
|
||||
insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: boolean;
|
||||
insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets: boolean;
|
||||
insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces: boolean;
|
||||
insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces: boolean;
|
||||
insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces: boolean;
|
||||
insertSpaceBeforeFunctionParenthesis: boolean;
|
||||
|
@ -37,6 +38,7 @@ namespace Configuration {
|
|||
export const insertSpaceBeforeFunctionParenthesis: string = 'insertSpaceBeforeFunctionParenthesis';
|
||||
export const insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: string = 'insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis';
|
||||
export const insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets: string = 'insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets';
|
||||
export const insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces: string = 'insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces';
|
||||
export const insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces: string = 'insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces';
|
||||
export const insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces: string = 'insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces';
|
||||
export const placeOpenBraceOnNewLineForFunctions: string = 'placeOpenBraceOnNewLineForFunctions';
|
||||
|
@ -64,6 +66,7 @@ namespace Configuration {
|
|||
result.insertSpaceBeforeFunctionParenthesis = false;
|
||||
result.insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis = false;
|
||||
result.insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets = false;
|
||||
result.insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces = true;
|
||||
result.insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces = false;
|
||||
result.insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces = false;
|
||||
result.placeOpenBraceOnNewLineForFunctions = false;
|
||||
|
@ -219,6 +222,7 @@ export default class TypeScriptFormattingProvider implements DocumentRangeFormat
|
|||
insertSpaceBeforeFunctionParenthesis: this.config.insertSpaceBeforeFunctionParenthesis,
|
||||
insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: this.config.insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis,
|
||||
insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets: this.config.insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets,
|
||||
insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces: this.config.insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces,
|
||||
insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces: this.config.insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces,
|
||||
insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces: this.config.insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces,
|
||||
placeOpenBraceOnNewLineForFunctions: this.config.placeOpenBraceOnNewLineForFunctions,
|
||||
|
|
Loading…
Reference in a new issue