mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-25 19:18:59 +01:00
Move survey ready logic into Surveyor
This commit is contained in:
@@ -90,8 +90,7 @@ function createLazyClientHost(
|
||||
|
||||
context.subscriptions.push(clientHost);
|
||||
|
||||
const surveyor = new Surveyor(context.globalState);
|
||||
context.subscriptions.push(clientHost.serviceClient.onSurveyReady(e => surveyor.surveyReady(e.surveyId)));
|
||||
context.subscriptions.push(new Surveyor(context.globalState, clientHost.serviceClient));
|
||||
|
||||
clientHost.serviceClient.onReady(() => {
|
||||
context.subscriptions.push(
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
|
||||
import * as vscode from 'vscode';
|
||||
import * as nls from 'vscode-nls';
|
||||
import TypeScriptServiceClient from '../typescriptServiceClient';
|
||||
import { Disposable } from './dispose';
|
||||
|
||||
const localize = nls.loadMessageBundle();
|
||||
|
||||
@@ -121,18 +123,23 @@ class Survey {
|
||||
}
|
||||
}
|
||||
|
||||
export class Surveyor {
|
||||
export class Surveyor extends Disposable {
|
||||
|
||||
private readonly surveys: Map<string, Survey>;
|
||||
|
||||
public constructor(
|
||||
memento: vscode.Memento
|
||||
memento: vscode.Memento,
|
||||
serviceClient: TypeScriptServiceClient,
|
||||
) {
|
||||
super();
|
||||
|
||||
this.surveys = new Map<string, Survey>(allSurveys.map(data =>
|
||||
[data.id, new Survey(data, memento)] as [string, Survey]));
|
||||
|
||||
this._register(serviceClient.onSurveyReady(e => this.surveyReady(e.surveyId)));
|
||||
}
|
||||
|
||||
public surveyReady(surveyId: string): void {
|
||||
private surveyReady(surveyId: string): void {
|
||||
const survey = this.tryGetActiveSurvey(surveyId);
|
||||
if (survey && survey.trigger()) {
|
||||
survey.willShow();
|
||||
|
||||
Reference in New Issue
Block a user