Skip to content

Commit 8f145a0

Browse files
authored
Disable console-eager-eval and Live Expressions panel (#165)
1 parent 97e9912 commit 8f145a0

File tree

3 files changed

+68
-56
lines changed

3 files changed

+68
-56
lines changed

front_end/panels/console/ConsolePrompt.ts

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ export class ConsolePrompt extends Common.ObjectWrapper.eventMixin<EventTypes, t
5353
private readonly innerPreviewElement: HTMLElement;
5454
private readonly promptIcon: IconButton.Icon.Icon;
5555
private readonly iconThrottler: Common.Throttler.Throttler;
56-
private readonly eagerEvalSetting: Common.Settings.Setting<boolean>;
56+
// TODO(T225263604): Restore this setting
57+
// private readonly eagerEvalSetting: Common.Settings.Setting<boolean>;
5758
private previewRequestForTest: Promise<void>|null;
5859
private highlightingNode: boolean;
5960
// The CodeMirror state field that controls whether the argument hints are showing.
@@ -112,9 +113,11 @@ export class ConsolePrompt extends Common.ObjectWrapper.eventMixin<EventTypes, t
112113
this.element.appendChild(this.promptIcon);
113114
this.iconThrottler = new Common.Throttler.Throttler(0);
114115

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

119122
this.element.tabIndex = 0;
120123
this.previewRequestForTest = null;
@@ -170,13 +173,14 @@ export class ConsolePrompt extends Common.ObjectWrapper.eventMixin<EventTypes, t
170173
})}`);
171174
}
172175

173-
private eagerSettingChanged(): void {
174-
const enabled = this.eagerEvalSetting.get();
175-
this.eagerPreviewElement.classList.toggle('hidden', !enabled);
176-
if (enabled) {
177-
void this.requestPreview();
178-
}
179-
}
176+
// TODO(T225263604): Restore this setting
177+
// private eagerSettingChanged(): void {
178+
// const enabled = this.eagerEvalSetting.get();
179+
// this.eagerPreviewElement.classList.toggle('hidden', !enabled);
180+
// if (enabled) {
181+
// void this.requestPreview();
182+
// }
183+
// }
180184

181185
belowEditorElement(): Element {
182186
return this.eagerPreviewElement;
@@ -185,12 +189,13 @@ export class ConsolePrompt extends Common.ObjectWrapper.eventMixin<EventTypes, t
185189
private onTextChanged(): void {
186190
// ConsoleView and prompt both use a throttler, so we clear the preview
187191
// ASAP to avoid inconsistency between a fresh viewport and stale preview.
188-
if (this.eagerEvalSetting.get()) {
189-
const asSoonAsPossible = !TextEditor.Config.contentIncludingHint(this.editor.editor);
190-
this.previewRequestForTest = this.textChangeThrottler.schedule(
191-
this.requestPreviewBound,
192-
asSoonAsPossible ? Common.Throttler.Scheduling.AsSoonAsPossible : Common.Throttler.Scheduling.Default);
193-
}
192+
// TODO(T225263604): Restore eager evaluation support
193+
// if (this.eagerEvalSetting.get()) {
194+
// const asSoonAsPossible = !TextEditor.Config.contentIncludingHint(this.editor.editor);
195+
// this.previewRequestForTest = this.textChangeThrottler.schedule(
196+
// this.requestPreviewBound,
197+
// asSoonAsPossible ? Common.Throttler.Scheduling.AsSoonAsPossible : Common.Throttler.Scheduling.Default);
198+
// }
194199
this.updatePromptIcon();
195200
this.dispatchEventToListeners(Events.TextChanged);
196201
}

front_end/panels/console/ConsoleView.ts

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,8 @@ export class ConsoleView extends UI.Widget.VBox implements
289289
private readonly timestampsSetting: Common.Settings.Setting<unknown>;
290290
private readonly consoleHistoryAutocompleteSetting: Common.Settings.Setting<boolean>;
291291
private selfXssWarningDisabledSetting: Common.Settings.Setting<boolean>;
292-
readonly pinPane: ConsolePinPane;
292+
// TODO(T225263604): Restore Live Expressions panel
293+
// readonly pinPane: ConsolePinPane;
293294
private viewport: ConsoleViewport;
294295
private messagesElement: HTMLElement;
295296
private messagesCountElement: HTMLElement;
@@ -406,8 +407,9 @@ export class ConsoleView extends UI.Widget.VBox implements
406407
toolbar.appendSeparator();
407408
toolbar.appendToolbarItem(this.consoleContextSelector.toolbarItem());
408409
toolbar.appendSeparator();
409-
const liveExpressionButton = UI.Toolbar.Toolbar.createActionButtonForId('console.create-pin');
410-
toolbar.appendToolbarItem(liveExpressionButton);
410+
// TODO(T225263604): Restore Live Expressions panel
411+
// const liveExpressionButton = UI.Toolbar.Toolbar.createActionButtonForId('console.create-pin');
412+
// toolbar.appendToolbarItem(liveExpressionButton);
411413
toolbar.appendSeparator();
412414
toolbar.appendToolbarItem(this.filter.textFilterUI);
413415
toolbar.appendToolbarItem(this.filter.levelMenuButton);
@@ -468,8 +470,9 @@ export class ConsoleView extends UI.Widget.VBox implements
468470

469471
ConsoleView.appendSettingsCheckboxToToolbar(
470472
settingsToolbarRight, monitoringXHREnabledSetting, i18nString(UIStrings.logXMLHttpRequests));
471-
ConsoleView.appendSettingsCheckboxToToolbar(
472-
settingsToolbarRight, 'console-eager-eval', i18nString(UIStrings.eagerlyEvaluateTextInThePrompt));
473+
// TODO(T225263604): Restore this setting
474+
// ConsoleView.appendSettingsCheckboxToToolbar(
475+
// settingsToolbarRight, 'console-eager-eval', i18nString(UIStrings.eagerlyEvaluateTextInThePrompt));
473476
ConsoleView.appendSettingsCheckboxToToolbar(
474477
settingsToolbarRight, this.consoleHistoryAutocompleteSetting, i18nString(UIStrings.autocompleteFromHistory));
475478
ConsoleView.appendSettingsCheckboxToToolbar(
@@ -481,9 +484,10 @@ export class ConsoleView extends UI.Widget.VBox implements
481484
this.showSettingsPaneSetting.addChangeListener(
482485
() => settingsPane.element.classList.toggle('hidden', !this.showSettingsPaneSetting.get()));
483486

484-
this.pinPane = new ConsolePinPane(liveExpressionButton, () => this.prompt.focus());
485-
this.pinPane.element.classList.add('console-view-pinpane');
486-
this.pinPane.show(this.contentsElement);
487+
// TODO(T225263604): Restore Live Expressions panel
488+
// this.pinPane = new ConsolePinPane(liveExpressionButton, () => this.prompt.focus());
489+
// this.pinPane.element.classList.add('console-view-pinpane');
490+
// this.pinPane.show(this.contentsElement);
487491

488492
this.viewport = new ConsoleViewport(this);
489493
this.viewport.setStickToBottom(true);
@@ -1827,9 +1831,10 @@ export class ActionDelegate implements UI.ActionRegistration.ActionDelegate {
18271831
case 'console.clear.history':
18281832
ConsoleView.instance().clearHistory();
18291833
return true;
1830-
case 'console.create-pin':
1831-
ConsoleView.instance().pinPane.addPin('', true /* userGesture */);
1832-
return true;
1834+
// TODO(T225263604): Restore Live Expressions panel
1835+
// case 'console.create-pin':
1836+
// ConsoleView.instance().pinPane.addPin('', true /* userGesture */);
1837+
// return true;
18331838
}
18341839
return false;
18351840
}

front_end/panels/console/console-meta.ts

Lines changed: 30 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -229,16 +229,17 @@ UI.ActionRegistration.registerActionExtension({
229229
},
230230
});
231231

232-
UI.ActionRegistration.registerActionExtension({
233-
actionId: 'console.create-pin',
234-
category: UI.ActionRegistration.ActionCategory.CONSOLE,
235-
title: i18nLazyString(UIStrings.createLiveExpression),
236-
iconClass: UI.ActionRegistration.IconClass.EYE,
237-
async loadActionDelegate() {
238-
const Console = await loadConsoleModule();
239-
return new Console.ConsoleView.ActionDelegate();
240-
},
241-
});
232+
// TODO(T225263604): Restore Live Expressions panel
233+
// UI.ActionRegistration.registerActionExtension({
234+
// actionId: 'console.create-pin',
235+
// category: UI.ActionRegistration.ActionCategory.CONSOLE,
236+
// title: i18nLazyString(UIStrings.createLiveExpression),
237+
// iconClass: UI.ActionRegistration.IconClass.EYE,
238+
// async loadActionDelegate() {
239+
// const Console = await loadConsoleModule();
240+
// return new Console.ConsoleView.ActionDelegate();
241+
// },
242+
// });
242243

243244
Common.Settings.registerSettingExtension({
244245
category: Common.Settings.SettingCategory.CONSOLE,
@@ -380,24 +381,25 @@ Common.Settings.registerSettingExtension({
380381
],
381382
});
382383

383-
Common.Settings.registerSettingExtension({
384-
category: Common.Settings.SettingCategory.CONSOLE,
385-
storageType: Common.Settings.SettingStorageType.Synced,
386-
title: i18nLazyString(UIStrings.eagerEvaluation),
387-
settingName: 'console-eager-eval',
388-
settingType: Common.Settings.SettingType.BOOLEAN,
389-
defaultValue: true,
390-
options: [
391-
{
392-
value: true,
393-
title: i18nLazyString(UIStrings.eagerlyEvaluateConsolePromptText),
394-
},
395-
{
396-
value: false,
397-
title: i18nLazyString(UIStrings.doNotEagerlyEvaluateConsole),
398-
},
399-
],
400-
});
384+
// TODO(T225263604): Restore this setting
385+
// Common.Settings.registerSettingExtension({
386+
// category: Common.Settings.SettingCategory.CONSOLE,
387+
// storageType: Common.Settings.SettingStorageType.Synced,
388+
// title: i18nLazyString(UIStrings.eagerEvaluation),
389+
// settingName: 'console-eager-eval',
390+
// settingType: Common.Settings.SettingType.BOOLEAN,
391+
// defaultValue: true,
392+
// options: [
393+
// {
394+
// value: true,
395+
// title: i18nLazyString(UIStrings.eagerlyEvaluateConsolePromptText),
396+
// },
397+
// {
398+
// value: false,
399+
// title: i18nLazyString(UIStrings.doNotEagerlyEvaluateConsole),
400+
// },
401+
// ],
402+
// });
401403

402404
Common.Settings.registerSettingExtension({
403405
category: Common.Settings.SettingCategory.CONSOLE,

0 commit comments

Comments
 (0)