Skip to content

Disable console-eager-eval and Live Expressions panel #164

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 22 additions & 17 deletions front_end/panels/console/ConsolePrompt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ export class ConsolePrompt extends Common.ObjectWrapper.eventMixin<EventTypes, t
private readonly innerPreviewElement: HTMLElement;
private readonly promptIcon: IconButton.Icon.Icon;
private readonly iconThrottler: Common.Throttler.Throttler;
private readonly eagerEvalSetting: Common.Settings.Setting<boolean>;
// TODO(T225263604): Restore this setting
// private readonly eagerEvalSetting: Common.Settings.Setting<boolean>;
private previewRequestForTest: Promise<void>|null;
private highlightingNode: boolean;
// The CodeMirror state field that controls whether the argument hints are showing.
Expand Down Expand Up @@ -112,9 +113,11 @@ export class ConsolePrompt extends Common.ObjectWrapper.eventMixin<EventTypes, t
this.element.appendChild(this.promptIcon);
this.iconThrottler = new Common.Throttler.Throttler(0);

this.eagerEvalSetting = Common.Settings.Settings.instance().moduleSetting('console-eager-eval');
this.eagerEvalSetting.addChangeListener(this.eagerSettingChanged.bind(this));
this.eagerPreviewElement.classList.toggle('hidden', !this.eagerEvalSetting.get());
// TODO(T225263604): Restore this setting
// this.eagerEvalSetting = Common.Settings.Settings.instance().moduleSetting('console-eager-eval');
// this.eagerEvalSetting.addChangeListener(this.eagerSettingChanged.bind(this));
// this.eagerPreviewElement.classList.toggle('hidden', !this.eagerEvalSetting.get());
this.eagerPreviewElement.classList.toggle('hidden', true);

this.element.tabIndex = 0;
this.previewRequestForTest = null;
Expand Down Expand Up @@ -170,13 +173,14 @@ export class ConsolePrompt extends Common.ObjectWrapper.eventMixin<EventTypes, t
})}`);
}

private eagerSettingChanged(): void {
const enabled = this.eagerEvalSetting.get();
this.eagerPreviewElement.classList.toggle('hidden', !enabled);
if (enabled) {
void this.requestPreview();
}
}
// TODO(T225263604): Restore this setting
// private eagerSettingChanged(): void {
// const enabled = this.eagerEvalSetting.get();
// this.eagerPreviewElement.classList.toggle('hidden', !enabled);
// if (enabled) {
// void this.requestPreview();
// }
// }

belowEditorElement(): Element {
return this.eagerPreviewElement;
Expand All @@ -185,12 +189,13 @@ export class ConsolePrompt extends Common.ObjectWrapper.eventMixin<EventTypes, t
private onTextChanged(): void {
// ConsoleView and prompt both use a throttler, so we clear the preview
// ASAP to avoid inconsistency between a fresh viewport and stale preview.
if (this.eagerEvalSetting.get()) {
const asSoonAsPossible = !TextEditor.Config.contentIncludingHint(this.editor.editor);
this.previewRequestForTest = this.textChangeThrottler.schedule(
this.requestPreviewBound,
asSoonAsPossible ? Common.Throttler.Scheduling.AsSoonAsPossible : Common.Throttler.Scheduling.Default);
}
// TODO(T225263604): Restore eager evaluation support
// if (this.eagerEvalSetting.get()) {
// const asSoonAsPossible = !TextEditor.Config.contentIncludingHint(this.editor.editor);
// this.previewRequestForTest = this.textChangeThrottler.schedule(
// this.requestPreviewBound,
// asSoonAsPossible ? Common.Throttler.Scheduling.AsSoonAsPossible : Common.Throttler.Scheduling.Default);
// }
this.updatePromptIcon();
this.dispatchEventToListeners(Events.TextChanged);
}
Expand Down
22 changes: 13 additions & 9 deletions front_end/panels/console/ConsoleView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,8 @@ export class ConsoleView extends UI.Widget.VBox implements
private readonly timestampsSetting: Common.Settings.Setting<unknown>;
private readonly consoleHistoryAutocompleteSetting: Common.Settings.Setting<boolean>;
private selfXssWarningDisabledSetting: Common.Settings.Setting<boolean>;
readonly pinPane: ConsolePinPane;
// TODO(T225263604): Restore Live Expressions panel
// readonly pinPane: ConsolePinPane;
private viewport: ConsoleViewport;
private messagesElement: HTMLElement;
private messagesCountElement: HTMLElement;
Expand Down Expand Up @@ -406,8 +407,9 @@ export class ConsoleView extends UI.Widget.VBox implements
toolbar.appendSeparator();
toolbar.appendToolbarItem(this.consoleContextSelector.toolbarItem());
toolbar.appendSeparator();
const liveExpressionButton = UI.Toolbar.Toolbar.createActionButtonForId('console.create-pin');
toolbar.appendToolbarItem(liveExpressionButton);
// TODO(T225263604): Restore Live Expressions panel
// const liveExpressionButton = UI.Toolbar.Toolbar.createActionButtonForId('console.create-pin');
// toolbar.appendToolbarItem(liveExpressionButton);
toolbar.appendSeparator();
toolbar.appendToolbarItem(this.filter.textFilterUI);
toolbar.appendToolbarItem(this.filter.levelMenuButton);
Expand Down Expand Up @@ -481,9 +483,10 @@ export class ConsoleView extends UI.Widget.VBox implements
this.showSettingsPaneSetting.addChangeListener(
() => settingsPane.element.classList.toggle('hidden', !this.showSettingsPaneSetting.get()));

this.pinPane = new ConsolePinPane(liveExpressionButton, () => this.prompt.focus());
this.pinPane.element.classList.add('console-view-pinpane');
this.pinPane.show(this.contentsElement);
// TODO(T225263604): Restore Live Expressions panel
// this.pinPane = new ConsolePinPane(liveExpressionButton, () => this.prompt.focus());
// this.pinPane.element.classList.add('console-view-pinpane');
// this.pinPane.show(this.contentsElement);

this.viewport = new ConsoleViewport(this);
this.viewport.setStickToBottom(true);
Expand Down Expand Up @@ -1827,9 +1830,10 @@ export class ActionDelegate implements UI.ActionRegistration.ActionDelegate {
case 'console.clear.history':
ConsoleView.instance().clearHistory();
return true;
case 'console.create-pin':
ConsoleView.instance().pinPane.addPin('', true /* userGesture */);
return true;
// TODO(T225263604): Restore Live Expressions panel
// case 'console.create-pin':
// ConsoleView.instance().pinPane.addPin('', true /* userGesture */);
// return true;
}
return false;
}
Expand Down
58 changes: 30 additions & 28 deletions front_end/panels/console/console-meta.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,16 +229,17 @@ UI.ActionRegistration.registerActionExtension({
},
});

UI.ActionRegistration.registerActionExtension({
actionId: 'console.create-pin',
category: UI.ActionRegistration.ActionCategory.CONSOLE,
title: i18nLazyString(UIStrings.createLiveExpression),
iconClass: UI.ActionRegistration.IconClass.EYE,
async loadActionDelegate() {
const Console = await loadConsoleModule();
return new Console.ConsoleView.ActionDelegate();
},
});
// TODO(T225263604): Restore Live Expressions panel
// UI.ActionRegistration.registerActionExtension({
// actionId: 'console.create-pin',
// category: UI.ActionRegistration.ActionCategory.CONSOLE,
// title: i18nLazyString(UIStrings.createLiveExpression),
// iconClass: UI.ActionRegistration.IconClass.EYE,
// async loadActionDelegate() {
// const Console = await loadConsoleModule();
// return new Console.ConsoleView.ActionDelegate();
// },
// });

Common.Settings.registerSettingExtension({
category: Common.Settings.SettingCategory.CONSOLE,
Expand Down Expand Up @@ -380,24 +381,25 @@ Common.Settings.registerSettingExtension({
],
});

Common.Settings.registerSettingExtension({
category: Common.Settings.SettingCategory.CONSOLE,
storageType: Common.Settings.SettingStorageType.Synced,
title: i18nLazyString(UIStrings.eagerEvaluation),
settingName: 'console-eager-eval',
settingType: Common.Settings.SettingType.BOOLEAN,
defaultValue: true,
options: [
{
value: true,
title: i18nLazyString(UIStrings.eagerlyEvaluateConsolePromptText),
},
{
value: false,
title: i18nLazyString(UIStrings.doNotEagerlyEvaluateConsole),
},
],
});
// TODO(T225263604): Restore this setting
// Common.Settings.registerSettingExtension({
// category: Common.Settings.SettingCategory.CONSOLE,
// storageType: Common.Settings.SettingStorageType.Synced,
// title: i18nLazyString(UIStrings.eagerEvaluation),
// settingName: 'console-eager-eval',
// settingType: Common.Settings.SettingType.BOOLEAN,
// defaultValue: true,
// options: [
// {
// value: true,
// title: i18nLazyString(UIStrings.eagerlyEvaluateConsolePromptText),
// },
// {
// value: false,
// title: i18nLazyString(UIStrings.doNotEagerlyEvaluateConsole),
// },
// ],
// });

Common.Settings.registerSettingExtension({
category: Common.Settings.SettingCategory.CONSOLE,
Expand Down
Loading