Remove check for context keys

This commit is contained in:
Bhavya U 2023-05-30 17:15:20 -07:00
parent 9f3c499c33
commit b6fb17e444
No known key found for this signature in database
GPG key ID: 4490FA54BAC7DDF8
2 changed files with 24 additions and 36 deletions

View file

@ -637,11 +637,6 @@ export interface IWelcomeDialog {
*/
message: string;
/**
* Context key expression to control the visibility of the welcome dialog.
*/
when: string;
/**
* Media to include in the welcome dialog.
*/

View file

@ -10,7 +10,7 @@ import { IStorageService, StorageScope } from 'vs/platform/storage/common/storag
import { IBrowserWorkbenchEnvironmentService } from 'vs/workbench/services/environment/browser/environmentService';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { Disposable } from 'vs/base/common/lifecycle';
import { ContextKeyExpr, IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
import { ICodeEditorService } from 'vs/editor/browser/services/codeEditorService';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { ICommandService } from 'vs/platform/commands/common/commands';
@ -28,12 +28,12 @@ import { IConfigurationRegistry, Extensions as ConfigurationExtensions, Configur
import { localize } from 'vs/nls';
import { applicationConfigurationNodeBase } from 'vs/workbench/common/configuration';
import { RunOnceScheduler } from 'vs/base/common/async';
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
const configurationKey = 'workbench.welcome.experimental.dialog';
class WelcomeDialogContribution extends Disposable implements IWorkbenchContribution {
private contextKeysToWatch = new Set<string>();
private isRendered = false;
constructor(
@ -50,7 +50,8 @@ class WelcomeDialogContribution extends Disposable implements IWorkbenchContribu
@IFileService readonly fileService: IFileService,
@INotificationService readonly notificationService: INotificationService,
@IExtensionService readonly extensionService: IExtensionService,
@ILanguageService readonly languageService: LanguageService
@ILanguageService readonly languageService: LanguageService,
@IEditorService readonly editorService: IEditorService
) {
super();
@ -68,37 +69,31 @@ class WelcomeDialogContribution extends Disposable implements IWorkbenchContribu
return;
}
this.contextKeysToWatch.add(welcomeDialog.when);
this._register(this.contextService.onDidChangeContext(e => {
if (e.affectsSome(this.contextKeysToWatch) && !this.isRendered) {
if (!Array.from(this.contextKeysToWatch).every(value => this.contextService.contextMatchesRules(ContextKeyExpr.deserialize(value)))) {
return;
}
const codeEditor = this.codeEditorService.getActiveCodeEditor();
this._register(editorService.onDidActiveEditorChange(() => {
if (!this.isRendered) {
const codeEditor = codeEditorService.getActiveCodeEditor();
if (codeEditor?.hasModel()) {
const scheduler = new RunOnceScheduler(() => {
this.isRendered = true;
const detailsRenderer = new GettingStartedDetailsRenderer(fileService, notificationService, extensionService, languageService);
if (codeEditor === codeEditorService.getActiveCodeEditor()) {
this.isRendered = true;
const detailsRenderer = new GettingStartedDetailsRenderer(fileService, notificationService, extensionService, languageService);
const welcomeWidget = new WelcomeWidget(
codeEditor,
instantiationService,
commandService,
telemetryService,
openerService,
webviewService,
detailsRenderer);
welcomeWidget.render(welcomeDialog.title,
welcomeDialog.message,
welcomeDialog.buttonText,
welcomeDialog.buttonCommand,
welcomeDialog.media);
const welcomeWidget = new WelcomeWidget(
codeEditor,
instantiationService,
commandService,
telemetryService,
openerService,
webviewService,
detailsRenderer);
welcomeWidget.render(welcomeDialog.title,
welcomeDialog.message,
welcomeDialog.buttonText,
welcomeDialog.buttonCommand,
welcomeDialog.media);
}
}, 3000);
this._register(codeEditor.onDidChangeModelContent((e) => {
@ -106,8 +101,6 @@ class WelcomeDialogContribution extends Disposable implements IWorkbenchContribu
scheduler.schedule();
}
}));
this.contextKeysToWatch.delete(welcomeDialog.when);
}
}
}));