mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 21:09:43 +00:00
Remove check for context keys
This commit is contained in:
parent
9f3c499c33
commit
b6fb17e444
|
@ -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.
|
||||
*/
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}));
|
||||
|
|
Loading…
Reference in a new issue