Skip to content

Commit

Permalink
Add typescript and javascript format.insertSpaceBeforeFunctionParenth…
Browse files Browse the repository at this point in the history
…esis (microsoft#21712)

* Update tsfmt.json

* Update formattingProvider.ts

* Update package.nls.json

* Update package.json

* Update package.json

* Add TS version requirement to description
  • Loading branch information
Mackenzie McClane authored and mjbvz committed Mar 2, 2017
1 parent ef2bdc0 commit 5e10fe2
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 4 deletions.
12 changes: 11 additions & 1 deletion extensions/typescript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,11 @@
"default": true,
"description": "%format.insertSpaceAfterFunctionKeywordForAnonymousFunctions%"
},
"typescript.format.insertSpaceBeforeFunctionParenthesis": {
"type": "boolean",
"default": false,
"description": "%format.insertSpaceBeforeFunctionParenthesis%"
},
"typescript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis": {
"type": "boolean",
"default": false,
Expand Down Expand Up @@ -229,6 +234,11 @@
"default": true,
"description": "%format.insertSpaceAfterFunctionKeywordForAnonymousFunctions%"
},
"javascript.format.insertSpaceBeforeFunctionParenthesis": {
"type": "boolean",
"default": false,
"description": "%format.insertSpaceBeforeFunctionParenthesis%"
},
"javascript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis": {
"type": "boolean",
"default": false,
Expand Down Expand Up @@ -357,4 +367,4 @@
}
]
}
}
}
3 changes: 2 additions & 1 deletion extensions/typescript/package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"format.insertSpaceBeforeAndAfterBinaryOperators": "Defines space handling after a binary operator.",
"format.insertSpaceAfterKeywordsInControlFlowStatements": "Defines space handling after keywords in a control flow statement.",
"format.insertSpaceAfterFunctionKeywordForAnonymousFunctions": "Defines space handling after function keyword for anonymous functions.",
"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.insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces": "Defines space handling after opening and before closing template string braces. Requires TypeScript >= 2.0.6.",
Expand All @@ -29,4 +30,4 @@
"typescript.referencesCodeLens.enabled": "Enable/disable references CodeLens.",
"typescript.implementationsCodeLens.enabled": "Enable/disable implementations CodeLens.",
"typescript.selectTypeScriptVersion.title": "Select TypeScript Version"
}
}
6 changes: 5 additions & 1 deletion extensions/typescript/src/features/formattingProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ interface Configuration {
insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets: boolean;
insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces: boolean;
insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces: boolean;
insertSpaceBeforeFunctionParenthesis: boolean;
placeOpenBraceOnNewLineForFunctions: boolean;
placeOpenBraceOnNewLineForControlBlocks: boolean;

Expand All @@ -33,6 +34,7 @@ namespace Configuration {
export const insertSpaceBeforeAndAfterBinaryOperators: string = 'insertSpaceBeforeAndAfterBinaryOperators';
export const insertSpaceAfterKeywordsInControlFlowStatements: string = 'insertSpaceAfterKeywordsInControlFlowStatements';
export const insertSpaceAfterFunctionKeywordForAnonymousFunctions: string = 'insertSpaceAfterFunctionKeywordForAnonymousFunctions';
export const insertSpaceBeforeFunctionParenthesis: string = 'insertSpaceBeforeFunctionParenthesis';
export const insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: string = 'insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis';
export const insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets: string = 'insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets';
export const insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces: string = 'insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces';
Expand All @@ -59,6 +61,7 @@ namespace Configuration {
result.insertSpaceBeforeAndAfterBinaryOperators = true;
result.insertSpaceAfterKeywordsInControlFlowStatements = true;
result.insertSpaceAfterFunctionKeywordForAnonymousFunctions = false;
result.insertSpaceBeforeFunctionParenthesis = false;
result.insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis = false;
result.insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets = false;
result.insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces = false;
Expand Down Expand Up @@ -213,6 +216,7 @@ export default class TypeScriptFormattingProvider implements DocumentRangeFormat
insertSpaceBeforeAndAfterBinaryOperators: this.config.insertSpaceBeforeAndAfterBinaryOperators,
insertSpaceAfterKeywordsInControlFlowStatements: this.config.insertSpaceAfterKeywordsInControlFlowStatements,
insertSpaceAfterFunctionKeywordForAnonymousFunctions: this.config.insertSpaceAfterFunctionKeywordForAnonymousFunctions,
insertSpaceBeforeFunctionParenthesis: this.config.insertSpaceBeforeFunctionParenthesis,
insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: this.config.insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis,
insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets: this.config.insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets,
insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces: this.config.insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces,
Expand All @@ -221,4 +225,4 @@ export default class TypeScriptFormattingProvider implements DocumentRangeFormat
placeOpenBraceOnNewLineForControlBlocks: this.config.placeOpenBraceOnNewLineForControlBlocks
};
}
}
}
3 changes: 2 additions & 1 deletion tsfmt.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis": false,
"insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets": false,
"insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces": false,
"insertSpaceBeforeFunctionParenthesis": false,
"placeOpenBraceOnNewLineForFunctions": false,
"placeOpenBraceOnNewLineForControlBlocks": false
}
}

0 comments on commit 5e10fe2

Please sign in to comment.