diff --git a/extensions/typescript/src/protocol.d.ts b/extensions/typescript/src/protocol.d.ts index 1910e976b91cbbd737c5b1126f279acb38e176ea..17c6c327705895b12545e2dd8dd6dcd66f7dfff8 100644 --- a/extensions/typescript/src/protocol.d.ts +++ b/extensions/typescript/src/protocol.d.ts @@ -1009,6 +1009,11 @@ export interface DiagnosticEventBody { * An array of diagnostic information items. */ diagnostics: Diagnostic[]; + + /** + * Information about the current length of the build queue. + */ + queueLength?: number; } /** diff --git a/extensions/typescript/src/typescriptMain.ts b/extensions/typescript/src/typescriptMain.ts index 02214ac896fa90ffa8f48fdf30beaf19b0caf9be..9a7e581b38f287cec181cd63f1c362bd2096a1f6 100644 --- a/extensions/typescript/src/typescriptMain.ts +++ b/extensions/typescript/src/typescriptMain.ts @@ -19,6 +19,9 @@ nls.config({locale: env.language}); import * as path from 'path'; import * as Proto from './protocol'; + +import * as Is from './utils/is'; + import TypeScriptServiceClient from './typescriptServiceClient'; import { ITypescriptServiceClientHost } from './typescriptService'; @@ -36,6 +39,7 @@ import WorkspaceSymbolProvider from './features/workspaceSymbolProvider'; import * as VersionStatus from './utils/versionStatus'; import * as ProjectStatus from './utils/projectStatus'; +import * as BuildStatus from './utils/buildStatus'; interface LanguageDescription { id: string; @@ -83,6 +87,7 @@ export function activate(context: ExtensionContext): void { }, () => { // Nothing to do here. The client did show a message; }); + BuildStatus.update({ queueLength: 0 }); } const validateSetting = 'validate.enable'; @@ -362,6 +367,9 @@ class TypeScriptServiceClientHost implements ITypescriptServiceClientHost { language.semanticDiagnosticsReceived(body.file, this.createMarkerDatas(body.diagnostics, language.diagnosticSource)); } } + if (Is.defined(body.queueLength)) { + BuildStatus.update( { queueLength: body.queueLength }); + } } private createMarkerDatas(diagnostics: Proto.Diagnostic[], source: string): Diagnostic[] { diff --git a/extensions/typescript/src/typescriptServiceClient.ts b/extensions/typescript/src/typescriptServiceClient.ts index c4f402dc67e4f7ffee43a31f5d48daeddfd2e306..503d010f15fba43598e13b44098fe818ee171fe7 100644 --- a/extensions/typescript/src/typescriptServiceClient.ts +++ b/extensions/typescript/src/typescriptServiceClient.ts @@ -241,6 +241,12 @@ export default class TypeScriptServiceClient implements ITypescriptServiceClient } private serviceStarted(resendModels: boolean): void { + if (this.storagePath) { + try { + fs.mkdirSync(this.storagePath); + } catch(error) { + } + } this.execute('configure', { autoBuild: this.storagePath ? true : false, metaDataDirectory: this.storagePath diff --git a/extensions/typescript/src/utils/buildStatus.ts b/extensions/typescript/src/utils/buildStatus.ts new file mode 100644 index 0000000000000000000000000000000000000000..cf640508af34c22673db6f2a47061e34249981b5 --- /dev/null +++ b/extensions/typescript/src/utils/buildStatus.ts @@ -0,0 +1,23 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +'use strict'; + +import vscode = require('vscode'); + +const statusItem: vscode.StatusBarItem = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Left, Number.MIN_VALUE); + +export interface BuildInfo { + queueLength: number; +} + +export function update(info: BuildInfo): void { + if (info.queueLength === 0) { + statusItem.hide(); + return; + } + statusItem.text = info.queueLength.toString(); + statusItem.show(); +} \ No newline at end of file