mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-28 18:12:45 -05:00
Added additional formatting options
This commit is contained in:
@@ -194,7 +194,7 @@
|
||||
{
|
||||
"isLicense": true, // We override the license since we need a coorect Copyright
|
||||
"name": "typescript",
|
||||
"version": "2.0.3",
|
||||
"version": "2.0.6",
|
||||
"license": "Apache2",
|
||||
"repositoryURL": "https://github.com/Microsoft/TypeScript",
|
||||
"description": "The contents of the folder lib is from the TypeScript project https://github.com/Microsoft/TypeScript.",
|
||||
|
||||
@@ -81,7 +81,7 @@
|
||||
"typescript.experimentalAutomaticTypeAcquisition": {
|
||||
"type": "boolean",
|
||||
"default": false,
|
||||
"description": "%typescript.experimentalAutomaticTypeAcquisition.desc%"
|
||||
"description": "%typescript.experimentalAutomaticTypeAcquisition%"
|
||||
},
|
||||
"typescript.check.workspaceVersion" :{
|
||||
"type": "boolean",
|
||||
@@ -144,6 +144,16 @@
|
||||
"default": false,
|
||||
"description": "%format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets%"
|
||||
},
|
||||
"typescript.format.insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces": {
|
||||
"type": "boolean",
|
||||
"default": false,
|
||||
"description": "%format.insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces%"
|
||||
},
|
||||
"typescript.format.insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces": {
|
||||
"type": "boolean",
|
||||
"default": false,
|
||||
"description": "%format.insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces%"
|
||||
},
|
||||
"typescript.format.placeOpenBraceOnNewLineForFunctions": {
|
||||
"type": "boolean",
|
||||
"default": false,
|
||||
@@ -194,6 +204,16 @@
|
||||
"default": false,
|
||||
"description": "%format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets%"
|
||||
},
|
||||
"javascript.format.insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces": {
|
||||
"type": "boolean",
|
||||
"default": false,
|
||||
"description": "%format.insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces%"
|
||||
},
|
||||
"javascript.format.insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces": {
|
||||
"type": "boolean",
|
||||
"default": false,
|
||||
"description": "%format.insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces%"
|
||||
},
|
||||
"javascript.format.placeOpenBraceOnNewLineForFunctions": {
|
||||
"type": "boolean",
|
||||
"default": false,
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
"typescript.useCodeSnippetsOnMethodSuggest.dec": "Complete functions with their parameter signature.",
|
||||
"typescript.tsdk.desc": "Specifies the folder path containing the tsserver and lib*.d.ts files to use.",
|
||||
"typescript.tsdk_version.desc": "Specifies the version of the tsserver. Only necessary if the tsserver is not installed using npm.",
|
||||
"typescript.experimentalAutomaticTypeAcquisition.desc": "Specifies whether the TyepScript language service should automatically aquire type definition files. Requirs TypeScript >= 2.0.6",
|
||||
"typescript.experimentalAutomaticTypeAcquisition": "Enable automatic type acquisition. Requirs TypeScript >= 2.0.6 and a restart after changing it.",
|
||||
"typescript.check.workspaceVersion": "Check if a TypeScript version is available in the workspace",
|
||||
"typescript.check.tscVersion": "Check if a global install TypeScript compiler (e.g. tsc) differs from the used TypeScript language service.",
|
||||
"typescript.tsserver.trace": "Enables tracing of messages send to the TS server",
|
||||
@@ -18,6 +18,8 @@
|
||||
"format.insertSpaceAfterFunctionKeywordForAnonymousFunctions": "Defines space handling after function keyword for anonymous functions",
|
||||
"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. Requirs TypeScript >= 2.0.6",
|
||||
"format.insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces": "Defines space handling after opening and before closing JSX expression braces. Requirs TypeScript >= 2.0.6",
|
||||
"format.placeOpenBraceOnNewLineForFunctions": "Defines whether an open brace is put onto a new line for functions or not",
|
||||
"format.placeOpenBraceOnNewLineForControlBlocks": "Defines whether an open brace is put onto a new line for control blocks or not",
|
||||
"javascript.validate.enable": "Enable / disable JavaScript validation"
|
||||
|
||||
@@ -18,6 +18,8 @@ interface Configuration {
|
||||
insertSpaceAfterFunctionKeywordForAnonymousFunctions: boolean;
|
||||
insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: boolean;
|
||||
insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets: boolean;
|
||||
insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces: boolean;
|
||||
insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces: boolean;
|
||||
placeOpenBraceOnNewLineForFunctions: boolean;
|
||||
placeOpenBraceOnNewLineForControlBlocks: boolean;
|
||||
}
|
||||
@@ -30,6 +32,8 @@ namespace Configuration {
|
||||
export const insertSpaceAfterFunctionKeywordForAnonymousFunctions: string = 'insertSpaceAfterFunctionKeywordForAnonymousFunctions';
|
||||
export const insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: string = 'insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis';
|
||||
export const insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets: string = 'insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets';
|
||||
export const insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces: string = 'insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces';
|
||||
export const insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces: string = 'insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces';
|
||||
export const placeOpenBraceOnNewLineForFunctions: string = 'placeOpenBraceOnNewLineForFunctions';
|
||||
export const placeOpenBraceOnNewLineForControlBlocks: string = 'placeOpenBraceOnNewLineForControlBlocks';
|
||||
|
||||
@@ -53,6 +57,8 @@ namespace Configuration {
|
||||
result.insertSpaceAfterFunctionKeywordForAnonymousFunctions = false;
|
||||
result.insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis = false;
|
||||
result.insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets = false;
|
||||
result.insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces = false;
|
||||
result.insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces = false;
|
||||
result.placeOpenBraceOnNewLineForFunctions = false;
|
||||
result.placeOpenBraceOnNewLineForControlBlocks = false;
|
||||
return result;
|
||||
@@ -175,6 +181,8 @@ export default class TypeScriptFormattingProvider implements DocumentRangeFormat
|
||||
insertSpaceAfterFunctionKeywordForAnonymousFunctions: this.config.insertSpaceAfterFunctionKeywordForAnonymousFunctions,
|
||||
insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: this.config.insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis,
|
||||
insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets: this.config.insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets,
|
||||
insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces: this.config.insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces,
|
||||
insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces: this.config.insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces,
|
||||
placeOpenBraceOnNewLineForFunctions: this.config.placeOpenBraceOnNewLineForFunctions,
|
||||
placeOpenBraceOnNewLineForControlBlocks: this.config.placeOpenBraceOnNewLineForControlBlocks
|
||||
};
|
||||
|
||||
@@ -44,6 +44,7 @@ interface LanguageDescription {
|
||||
diagnosticSource: string;
|
||||
modeIds: string[];
|
||||
extensions: string[];
|
||||
configFile: string;
|
||||
}
|
||||
|
||||
export function activate(context: ExtensionContext): void {
|
||||
@@ -57,13 +58,15 @@ export function activate(context: ExtensionContext): void {
|
||||
id: 'typescript',
|
||||
diagnosticSource: 'ts',
|
||||
modeIds: [MODE_ID_TS, MODE_ID_TSX],
|
||||
extensions: ['.ts', '.tsx']
|
||||
extensions: ['.ts', '.tsx'],
|
||||
configFile: 'tsconfig.json'
|
||||
},
|
||||
{
|
||||
id: 'javascript',
|
||||
diagnosticSource: 'js',
|
||||
modeIds: [MODE_ID_JS, MODE_ID_JSX],
|
||||
extensions: ['.js', '.jsx']
|
||||
extensions: ['.js', '.jsx'],
|
||||
configFile: 'jsconfig.json'
|
||||
}
|
||||
], context.storagePath, context.globalState);
|
||||
|
||||
@@ -211,7 +214,11 @@ class LanguageProvider {
|
||||
|
||||
public handles(file: string): boolean {
|
||||
let extension = path.extname(file);
|
||||
return (extension && this.extensions[extension]) || this.bufferSyncSupport.handles(file);
|
||||
if ((extension && this.extensions[extension]) || this.bufferSyncSupport.handles(file)) {
|
||||
return true;
|
||||
}
|
||||
let basename = path.basename(file);
|
||||
return basename && basename === this.description.configFile;
|
||||
}
|
||||
|
||||
public get id(): string {
|
||||
@@ -359,7 +366,7 @@ class TypeScriptServiceClientHost implements ITypescriptServiceClientHost {
|
||||
/* https://github.com/Microsoft/TypeScript/issues/10473
|
||||
const body = event.body;
|
||||
if (body.diagnostics) {
|
||||
const language = this.findLanguage(body.triggerFile);
|
||||
const language = body.triggerFile ? this.findLanguage(body.triggerFile) : this.findLanguage(body.configFile);
|
||||
if (language) {
|
||||
if (body.diagnostics.length === 0) {
|
||||
language.configFileDiagnosticsReceived(body.configFile, []);
|
||||
|
||||
Reference in New Issue
Block a user