Add support for build status

This commit is contained in:
Dirk Baeumer
2016-06-22 09:58:09 +02:00
parent a4aeaa1d67
commit ab50c4dc88
4 changed files with 42 additions and 0 deletions
+5
View File
@@ -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;
}
/**
@@ -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[] {
@@ -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
@@ -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();
}