[webkit-changes] [WebKit/WebKit] e058a9: Web Inspector: CSS source editor can adopt fuzzy s...
Qianlang Chen
noreply at github.com
Wed May 22 12:08:42 PDT 2024
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: e058a9c99c8c35dac22dc6095343a4895a6fb168
https://github.com/WebKit/WebKit/commit/e058a9c99c8c35dac22dc6095343a4895a6fb168
Author: Qianlang Chen <qianlangchen at apple.com>
Date: 2024-05-22 (Wed, 22 May 2024)
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/Main.html
M Source/WebInspectorUI/UserInterface/Models/CSSCompletions.js
A Source/WebInspectorUI/UserInterface/Models/Completions.js
M Source/WebInspectorUI/UserInterface/Test.html
M Source/WebInspectorUI/UserInterface/Views/SettingsTabContentView.js
Log Message:
-----------
Web Inspector: CSS source editor can adopt fuzzy search for code completion
rdar://125030691
https://bugs.webkit.org/show_bug.cgi?id=271260
Reviewed by Devin Rousso.
Use CSSCompletions.executeQuery instead of CSSCompletions.startsWith
when language mode is CSS, since executeQuery uses fuzzy search.
Also add an setting item in the Settings tab's Experimental sub-tab to
optionally turn this feature off.
* Source/WebInspectorUI/UserInterface/Controllers/CodeMirrorCompletionController.js:
(WI.CodeMirrorCompletionController.prototype._generateCSSCompletions):
- Optionally apply fuzzy search by using `executeQuery`.
(WI.CodeMirrorCompletionController.prototype.updateCompletions):
- The argument `completions` could now also be an array of objects
instead of always an array of strings (due to executeQuery
returning an array of objects). Those objects also contain info on
which characters match in the fuzzy search, so the suggestion box
can bold the matching text. `this._completions` however does not
need this extra info, so we extract only the texts from
`completions` for that.
(WI.CodeMirrorCompletionController.prototype._applyCompletionHint):
(WI.CodeMirrorCompletionController.prototype._applyCompletionHint.update):
- Fuzzy search can now match completions not necessarily starting
with the same text as currentText. Only show the gray watermark
text (hint marker in code) when it's actually a prefix match.
* Source/WebInspectorUI/UserInterface/Models/Completions.js: Added.
* Source/WebInspectorUI/UserInterface/Models/CSSCompletions.js:
(WI.CSSCompletions.getCompletionText):
- As the getCompletionText helper function doesn't have to work for
only CSS suggestions, it better belongs to a class with a more
generic name like Completion instead of CSSCompletion.
- Leave a note to eventually migrate all other usages of the old
CSSCompletion.getCompletionText to Completion.getCompletionText.
* Source/WebInspectorUI/UserInterface/Main.html:
* Source/WebInspectorUI/UserInterface/Test.html:
- Include the new Completions.js source file.
* Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js:
* Source/WebInspectorUI/UserInterface/Base/Setting.js:
* Source/WebInspectorUI/UserInterface/Views/SettingsTabContentView.js:
- Add an experimental setting item for this feature change.
Canonical link: https://commits.webkit.org/279144@main
To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications
More information about the webkit-changes
mailing list