提交 ff52542f 编写于 作者: D Dirk Baeumer

Make experimental auto build a setting

上级 ab50c4dc
......@@ -71,6 +71,17 @@
"default": null,
"description": "%typescript.tsdk.desc%"
},
"typescript.tsserver.trace": {
"type": "string",
"enum": ["off", "messages", "verbose"],
"default": "off",
"description": "%typescript.tsserver.trace%"
},
"typescript.tsserver.experimentalAutoBuild": {
"type": "boolean",
"default": false,
"description": "%typescript.tsserver.experimentalAutoBuild%"
},
"typescript.useCodeSnippetsOnMethodSuggest": {
"type": "boolean",
"default": false,
......@@ -81,12 +92,6 @@
"default": true,
"description": "%typescript.validate.enable%"
},
"typescript.tsserver.trace": {
"type": "string",
"enum": ["off", "messages", "verbose"],
"default": "off",
"description": "%typescript.tsserver.trace%"
},
"typescript.format.insertSpaceAfterCommaDelimiter": {
"type": "boolean",
"default": true,
......
......@@ -5,6 +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.tsserver.trace": "Enables tracing of messages send to the TS server",
"typescript.tsserver.experimentalAutoBuild": "Enables experimental auto build. Requires 1.9 dev or 2.x tsserver version and a restart of VS Code after changing it.",
"typescript.validate.enable": "Enable / disable TypeScript validation",
"format.insertSpaceAfterCommaDelimiter": "Defines space handling after a comma delimiter",
"format.insertSpaceAfterSemicolonInForStatements": " Defines space handling after a semicolon in a for statement",
......
......@@ -214,24 +214,14 @@ export default class BufferSyncSupport {
}
public requestDiagnostic(file: string): void {
if (!!true) {
if (!this._validate || this.client.experimentalAutoBuild) {
return;
}
if (!this._validate) {
return;
}
if (!this.projectValidationRequested) {
this.client.execute('geterrForProject' , {
file: file,
delay: -1,
watch: true
}, false);
this.projectValidationRequested = true;
}
// this.pendingDiagnostics[file] = Date.now();
// this.diagnosticDelayer.trigger(() => {
// this.sendPendingDiagnostics();
// });
this.pendingDiagnostics[file] = Date.now();
this.diagnosticDelayer.trigger(() => {
this.sendPendingDiagnostics();
});
}
private sendPendingDiagnostics(): void {
......
......@@ -20,6 +20,8 @@ export interface ITypescriptServiceClient {
logTelemetry(eventName: string, properties?: { [prop: string]: string });
experimentalAutoBuild: boolean;
execute(command:'configure', args: Proto.ConfigureRequestArguments, token?: CancellationToken):Promise<Proto.ConfigureResponse>;
execute(command:'open', args: Proto.OpenRequestArgs, expectedResult:boolean, token?: CancellationToken):Promise<any>;
execute(command:'close', args: Proto.FileRequestArgs, expectedResult:boolean, token?: CancellationToken):Promise<any>;
......
......@@ -73,6 +73,7 @@ export default class TypeScriptServiceClient implements ITypescriptServiceClient
private _onReady: { promise: Promise<void>; resolve: () => void; reject: () => void; };
private tsdk: string;
private _experimentalAutoBuild: boolean;
private trace: Trace;
private output: OutputChannel;
private servicePromise: Promise<cp.ChildProcess>;
......@@ -111,7 +112,9 @@ export default class TypeScriptServiceClient implements ITypescriptServiceClient
this.requestQueue = [];
this.pendingResponses = 0;
this.callbacks = Object.create(null);
this.tsdk = workspace.getConfiguration().get<string>('typescript.tsdk', null);
const configuration = workspace.getConfiguration();
this.tsdk = configuration.get<string>('typescript.tsdk', null);
this._experimentalAutoBuild = configuration.get<boolean>('typescript.tsserver.experimentalAutoBuild', false);
this.trace = this.readTrace();
workspace.onDidChangeConfiguration(() => {
this.trace = this.readTrace();
......@@ -138,6 +141,10 @@ export default class TypeScriptServiceClient implements ITypescriptServiceClient
return result;
}
public get experimentalAutoBuild(): boolean {
return this._experimentalAutoBuild;
}
public onReady(): Promise<void> {
return this._onReady.promise;
}
......@@ -241,16 +248,16 @@ export default class TypeScriptServiceClient implements ITypescriptServiceClient
}
private serviceStarted(resendModels: boolean): void {
if (this.storagePath) {
if (this._experimentalAutoBuild && this.storagePath) {
try {
fs.mkdirSync(this.storagePath);
} catch(error) {
}
this.execute('configure', {
autoBuild: true,
metaDataDirectory: this.storagePath
});
}
this.execute('configure', {
autoBuild: this.storagePath ? true : false,
metaDataDirectory: this.storagePath
});
if (resendModels) {
this.host.populateService();
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册