mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-27 03:54:24 +01:00
Merge remote-tracking branch 'origin/master' into chrmarti/welcomeexperience
This commit is contained in:
@@ -40,7 +40,7 @@ import ReferenceCodeLensProvider from './features/referencesCodeLensProvider';
|
||||
|
||||
import * as BuildStatus from './utils/buildStatus';
|
||||
import * as ProjectStatus from './utils/projectStatus';
|
||||
import TypingsStatus from './utils/typingsStatus';
|
||||
import TypingsStatus, { AtaProgressReporter } from './utils/typingsStatus';
|
||||
import * as VersionStatus from './utils/versionStatus';
|
||||
|
||||
interface LanguageDescription {
|
||||
@@ -128,6 +128,7 @@ class LanguageProvider {
|
||||
this.currentDiagnostics = languages.createDiagnosticCollection(description.id);
|
||||
|
||||
this.typingsStatus = new TypingsStatus(client);
|
||||
new AtaProgressReporter(client);
|
||||
|
||||
workspace.onDidChangeConfiguration(this.configurationChanged, this);
|
||||
this.configurationChanged();
|
||||
|
||||
@@ -3,10 +3,14 @@
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
/// <reference path="../../../../src/vs/vscode.proposed.d.ts" />
|
||||
|
||||
'use strict';
|
||||
|
||||
import * as vscode from 'vscode';
|
||||
import { ITypescriptServiceClient } from '../typescriptService';
|
||||
import { loadMessageBundle } from 'vscode-nls';
|
||||
const localize = loadMessageBundle();
|
||||
|
||||
const typingsInstallTimeout = 30 * 1000;
|
||||
|
||||
@@ -54,4 +58,42 @@ export default class TypingsStatus extends vscode.Disposable {
|
||||
}
|
||||
delete this._acquiringTypings[eventId];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export class AtaProgressReporter {
|
||||
|
||||
private _promises = new Map<number, Function>();
|
||||
private _disposable: vscode.Disposable;
|
||||
|
||||
constructor(client: ITypescriptServiceClient) {
|
||||
this._disposable = vscode.Disposable.from(
|
||||
client.onDidBeginInstallTypings(e => this._onBegin(e.eventId)),
|
||||
client.onDidEndInstallTypings(e => this._onEndOrTimeout(e.eventId))
|
||||
);
|
||||
}
|
||||
|
||||
dispose(): void {
|
||||
this._disposable.dispose();
|
||||
this._promises.forEach(value => value());
|
||||
}
|
||||
|
||||
private _onBegin(eventId: number): void {
|
||||
const handle = setTimeout(() => this._onEndOrTimeout(eventId), typingsInstallTimeout);
|
||||
const promise = new Promise(resolve => {
|
||||
this._promises.set(eventId, () => {
|
||||
clearTimeout(handle);
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
|
||||
vscode.window.withWindowProgress(localize('installingPackages', "Fetching data for better TypeScript IntelliSense"), () => promise);
|
||||
}
|
||||
|
||||
private _onEndOrTimeout(eventId: number): void {
|
||||
const resolve = this._promises.get(eventId);
|
||||
if (resolve) {
|
||||
this._promises.delete(eventId);
|
||||
resolve();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user