mirror of
https://github.com/Microsoft/vscode
synced 2024-09-13 21:55:38 +00:00
Merge pull request #183887 from microsoft/dev/bhavyau/welcome-widget
Remove check for context keys
This commit is contained in:
commit
5c01360bd7
|
@ -637,11 +637,6 @@ export interface IWelcomeDialog {
|
||||||
*/
|
*/
|
||||||
message: string;
|
message: string;
|
||||||
|
|
||||||
/**
|
|
||||||
* Context key expression to control the visibility of the welcome dialog.
|
|
||||||
*/
|
|
||||||
when: string;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Media to include in the welcome dialog.
|
* 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 { IBrowserWorkbenchEnvironmentService } from 'vs/workbench/services/environment/browser/environmentService';
|
||||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||||
import { Disposable } from 'vs/base/common/lifecycle';
|
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 { ICodeEditorService } from 'vs/editor/browser/services/codeEditorService';
|
||||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||||
import { ICommandService } from 'vs/platform/commands/common/commands';
|
import { ICommandService } from 'vs/platform/commands/common/commands';
|
||||||
|
@ -28,12 +28,12 @@ import { IConfigurationRegistry, Extensions as ConfigurationExtensions, Configur
|
||||||
import { localize } from 'vs/nls';
|
import { localize } from 'vs/nls';
|
||||||
import { applicationConfigurationNodeBase } from 'vs/workbench/common/configuration';
|
import { applicationConfigurationNodeBase } from 'vs/workbench/common/configuration';
|
||||||
import { RunOnceScheduler } from 'vs/base/common/async';
|
import { RunOnceScheduler } from 'vs/base/common/async';
|
||||||
|
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||||
|
|
||||||
const configurationKey = 'workbench.welcome.experimental.dialog';
|
const configurationKey = 'workbench.welcome.experimental.dialog';
|
||||||
|
|
||||||
class WelcomeDialogContribution extends Disposable implements IWorkbenchContribution {
|
class WelcomeDialogContribution extends Disposable implements IWorkbenchContribution {
|
||||||
|
|
||||||
private contextKeysToWatch = new Set<string>();
|
|
||||||
private isRendered = false;
|
private isRendered = false;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
|
@ -50,7 +50,8 @@ class WelcomeDialogContribution extends Disposable implements IWorkbenchContribu
|
||||||
@IFileService readonly fileService: IFileService,
|
@IFileService readonly fileService: IFileService,
|
||||||
@INotificationService readonly notificationService: INotificationService,
|
@INotificationService readonly notificationService: INotificationService,
|
||||||
@IExtensionService readonly extensionService: IExtensionService,
|
@IExtensionService readonly extensionService: IExtensionService,
|
||||||
@ILanguageService readonly languageService: LanguageService
|
@ILanguageService readonly languageService: LanguageService,
|
||||||
|
@IEditorService readonly editorService: IEditorService
|
||||||
) {
|
) {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
|
@ -68,37 +69,31 @@ class WelcomeDialogContribution extends Disposable implements IWorkbenchContribu
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.contextKeysToWatch.add(welcomeDialog.when);
|
this._register(editorService.onDidActiveEditorChange(() => {
|
||||||
|
if (!this.isRendered) {
|
||||||
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();
|
|
||||||
|
|
||||||
|
const codeEditor = codeEditorService.getActiveCodeEditor();
|
||||||
if (codeEditor?.hasModel()) {
|
if (codeEditor?.hasModel()) {
|
||||||
const scheduler = new RunOnceScheduler(() => {
|
const scheduler = new RunOnceScheduler(() => {
|
||||||
this.isRendered = true;
|
if (codeEditor === codeEditorService.getActiveCodeEditor()) {
|
||||||
const detailsRenderer = new GettingStartedDetailsRenderer(fileService, notificationService, extensionService, languageService);
|
this.isRendered = true;
|
||||||
|
const detailsRenderer = new GettingStartedDetailsRenderer(fileService, notificationService, extensionService, languageService);
|
||||||
|
|
||||||
const welcomeWidget = new WelcomeWidget(
|
const welcomeWidget = new WelcomeWidget(
|
||||||
codeEditor,
|
codeEditor,
|
||||||
instantiationService,
|
instantiationService,
|
||||||
commandService,
|
commandService,
|
||||||
telemetryService,
|
telemetryService,
|
||||||
openerService,
|
openerService,
|
||||||
webviewService,
|
webviewService,
|
||||||
detailsRenderer);
|
detailsRenderer);
|
||||||
|
|
||||||
welcomeWidget.render(welcomeDialog.title,
|
|
||||||
welcomeDialog.message,
|
|
||||||
welcomeDialog.buttonText,
|
|
||||||
welcomeDialog.buttonCommand,
|
|
||||||
welcomeDialog.media);
|
|
||||||
|
|
||||||
|
welcomeWidget.render(welcomeDialog.title,
|
||||||
|
welcomeDialog.message,
|
||||||
|
welcomeDialog.buttonText,
|
||||||
|
welcomeDialog.buttonCommand,
|
||||||
|
welcomeDialog.media);
|
||||||
|
}
|
||||||
}, 3000);
|
}, 3000);
|
||||||
|
|
||||||
this._register(codeEditor.onDidChangeModelContent((e) => {
|
this._register(codeEditor.onDidChangeModelContent((e) => {
|
||||||
|
@ -106,8 +101,6 @@ class WelcomeDialogContribution extends Disposable implements IWorkbenchContribu
|
||||||
scheduler.schedule();
|
scheduler.schedule();
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
this.contextKeysToWatch.delete(welcomeDialog.when);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|
Loading…
Reference in a new issue