Skip to content

Commit b6fb17e

Browse files
committed
Remove check for context keys
1 parent 9f3c499 commit b6fb17e

File tree

2 files changed

+26
-38
lines changed

2 files changed

+26
-38
lines changed

src/vs/workbench/browser/web.api.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -637,11 +637,6 @@ export interface IWelcomeDialog {
637637
*/
638638
message: string;
639639

640-
/**
641-
* Context key expression to control the visibility of the welcome dialog.
642-
*/
643-
when: string;
644-
645640
/**
646641
* Media to include in the welcome dialog.
647642
*/

src/vs/workbench/contrib/welcomeDialog/browser/welcomeDialog.contribution.ts

Lines changed: 26 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { IStorageService, StorageScope } from 'vs/platform/storage/common/storag
1010
import { IBrowserWorkbenchEnvironmentService } from 'vs/workbench/services/environment/browser/environmentService';
1111
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
1212
import { Disposable } from 'vs/base/common/lifecycle';
13-
import { ContextKeyExpr, IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
13+
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
1414
import { ICodeEditorService } from 'vs/editor/browser/services/codeEditorService';
1515
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
1616
import { ICommandService } from 'vs/platform/commands/common/commands';
@@ -28,12 +28,12 @@ import { IConfigurationRegistry, Extensions as ConfigurationExtensions, Configur
2828
import { localize } from 'vs/nls';
2929
import { applicationConfigurationNodeBase } from 'vs/workbench/common/configuration';
3030
import { RunOnceScheduler } from 'vs/base/common/async';
31+
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
3132

3233
const configurationKey = 'workbench.welcome.experimental.dialog';
3334

3435
class WelcomeDialogContribution extends Disposable implements IWorkbenchContribution {
3536

36-
private contextKeysToWatch = new Set<string>();
3737
private isRendered = false;
3838

3939
constructor(
@@ -50,7 +50,8 @@ class WelcomeDialogContribution extends Disposable implements IWorkbenchContribu
5050
@IFileService readonly fileService: IFileService,
5151
@INotificationService readonly notificationService: INotificationService,
5252
@IExtensionService readonly extensionService: IExtensionService,
53-
@ILanguageService readonly languageService: LanguageService
53+
@ILanguageService readonly languageService: LanguageService,
54+
@IEditorService readonly editorService: IEditorService
5455
) {
5556
super();
5657

@@ -68,46 +69,38 @@ class WelcomeDialogContribution extends Disposable implements IWorkbenchContribu
6869
return;
6970
}
7071

71-
this.contextKeysToWatch.add(welcomeDialog.when);
72-
73-
this._register(this.contextService.onDidChangeContext(e => {
74-
if (e.affectsSome(this.contextKeysToWatch) && !this.isRendered) {
75-
76-
if (!Array.from(this.contextKeysToWatch).every(value => this.contextService.contextMatchesRules(ContextKeyExpr.deserialize(value)))) {
77-
return;
78-
}
79-
80-
const codeEditor = this.codeEditorService.getActiveCodeEditor();
72+
this._register(editorService.onDidActiveEditorChange(() => {
73+
if (!this.isRendered) {
8174

75+
const codeEditor = codeEditorService.getActiveCodeEditor();
8276
if (codeEditor?.hasModel()) {
8377
const scheduler = new RunOnceScheduler(() => {
84-
this.isRendered = true;
85-
const detailsRenderer = new GettingStartedDetailsRenderer(fileService, notificationService, extensionService, languageService);
86-
87-
const welcomeWidget = new WelcomeWidget(
88-
codeEditor,
89-
instantiationService,
90-
commandService,
91-
telemetryService,
92-
openerService,
93-
webviewService,
94-
detailsRenderer);
95-
96-
welcomeWidget.render(welcomeDialog.title,
97-
welcomeDialog.message,
98-
welcomeDialog.buttonText,
99-
welcomeDialog.buttonCommand,
100-
welcomeDialog.media);
101-
78+
if (codeEditor === codeEditorService.getActiveCodeEditor()) {
79+
this.isRendered = true;
80+
const detailsRenderer = new GettingStartedDetailsRenderer(fileService, notificationService, extensionService, languageService);
81+
82+
const welcomeWidget = new WelcomeWidget(
83+
codeEditor,
84+
instantiationService,
85+
commandService,
86+
telemetryService,
87+
openerService,
88+
webviewService,
89+
detailsRenderer);
90+
91+
welcomeWidget.render(welcomeDialog.title,
92+
welcomeDialog.message,
93+
welcomeDialog.buttonText,
94+
welcomeDialog.buttonCommand,
95+
welcomeDialog.media);
96+
}
10297
}, 3000);
10398

10499
this._register(codeEditor.onDidChangeModelContent((e) => {
105100
if (!this.isRendered) {
106101
scheduler.schedule();
107102
}
108103
}));
109-
110-
this.contextKeysToWatch.delete(welcomeDialog.when);
111104
}
112105
}
113106
}));

0 commit comments

Comments
 (0)