Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: de6b0711cfc247bd3f9c563e75dcf6d0a62321bb
https://github.com/WebKit/WebKit/commit/de6b0711cfc247bd3f9c563e75dcf6d0a62321bb
Author: Devin Rousso <[email protected]>
Date: 2026-10-05 (Mon, 05 Oct 2026)
Changed paths:
M Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js
M Source/WebInspectorUI/UserInterface/Base/Setting.js
M
Source/WebInspectorUI/UserInterface/Controllers/CodeMirrorCompletionController.js
M
Source/WebInspectorUI/UserInterface/Controllers/JavaScriptLogViewController.js
M Source/WebInspectorUI/UserInterface/Views/ConsolePrompt.css
M Source/WebInspectorUI/UserInterface/Views/ConsolePrompt.js
M Source/WebInspectorUI/UserInterface/Views/SettingsTabContentView.js
Log Message:
-----------
Web Inspector: Console: show evaluation previews
https://bugs.webkit.org/show_bug.cgi?id=319348
Reviewed by Timothy Hatcher.
This helps developers crawl object chains as it shows the result of the current
text without evaluating it.
Otherwise, they'd likely have to separately evaluate `foo` then `foo.bar` then
`foo.bar.baz` in order to know they've got it right.
The preview will show that `foo` has a `bar` property without needing to
evaluate it and then re-type it again.
* Source/WebInspectorUI/UserInterface/Views/ConsolePrompt.js:
(WI.ConsolePrompt):
(WI.ConsolePrompt.prototype.completionControllerCompletionApplied): Added.
(WI.ConsolePrompt.prototype.completionControllerCompletionsHidden): Added.
(WI.ConsolePrompt.prototype._handleCodeMirrorChange): Added.
(WI.ConsolePrompt.prototype._handleEvaluationEnvironmentChanged): Added.
(WI.ConsolePrompt.prototype._handleEvaluationPreviewSettingChanged): Added.
(WI.ConsolePrompt.prototype._scheduleEvaluationPreviewUpdate): Added.
(WI.ConsolePrompt.prototype._renderEvaluationPreview): Added.
(WI.ConsolePrompt.prototype._cancelEvaluationPreview): Added.
(WI.ConsolePrompt.prototype._handleEnterKey.commitTextOrInsertNewLine):
* Source/WebInspectorUI/UserInterface/Views/ConsolePrompt.css:
(.console-prompt):
(.console-prompt > .CodeMirror):
(.console-prompt > .evaluation-preview): Added.
(.console-prompt > .evaluation-preview:empty::before): Added.
(.console-prompt > .evaluation-preview:not(:empty)::before): Added.
The preview does not allow any interactions and is visually distinguished (i.e.
greyscale) from the prompt.
It will show all evaluation results except `SyntaxError` as that's common while
typing (e.g. `foo.`).
*
Source/WebInspectorUI/UserInterface/Controllers/JavaScriptLogViewController.js:
(WI.JavaScriptLogViewController):
(WI.JavaScriptLogViewController.prototype.consolePromptGetEvaluationPreviewObject):
Added.
Evaluate the text and then immediately release the result `WI.RemoteObject` as
we only need to show a preview.
Use an `objectGroup` just in case there are any descendant `WI.RemoteObject` as
they are also not needed.
*
Source/WebInspectorUI/UserInterface/Controllers/CodeMirrorCompletionController.js:
(WI.CodeMirrorCompletionController.prototype.textWithCurrentCompletion): Added.
(WI.CodeMirrorCompletionController.prototype._applyCompletionHint):
Allow the owner of this to know what the current text shown is and when the
developer selects a completion.
* Source/WebInspectorUI/UserInterface/Base/Setting.js:
* Source/WebInspectorUI/UserInterface/Views/SettingsTabContentView.js:
(WI.SettingsTabContentView.prototype._createConsoleSettingsView):
Allow developers to turn off this feature as evaluation previews can result in
unintended side-effects.
* Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js:
Canonical link: https://commits.webkit.org/322754@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications