Repository navigation
Description
With Find Widget introduced in File Explorer and Notebook Editor, we now have multiple implementations for input box with multiple filter/toggles. We reused FindInput which has 3 built-in filters (caseSensitivity, wholeWord and regex) and had to add additional filters in our own ways. File Explorer and Notebook handles this differently and there isn't a clear path of how they can be unified and how other input box users can adopt this in the future.
In addition, Problems panel and Terminal recent commands have their own input box with a single filter, which are not inherited from find input.
Variations
Text Editor
- 3 built-in filters
- Additional filter (Find in Selection) as a separate button
Terminal
- 3 built-in filters only
Webview
- Built-in filters all disabled/hidden
File Explorer
- Built-in filters disabled/hidden
- Additional filter shown as a toggle inside the input box
Notebook
- 3 built-in filters only
- Additional filters shown in a dropdown/context menu
Problems
- Multiple filters which are specific to Problems only
Proposal
The input boxes from find widgets shown above all derive from the original FindWidget in Monaco, which only has 3 builtin filters and they are no longer universal as not all embedders have the capability of implementing all of them. Embedders also have the need to the extend the filters which is not well supported, leading to the fragmentation of the find widgets.
The proposal here is experimenting if we can introduce a generic input box with dynamic filters support at the base/platform level (not from editor or workbench). The common features are:
- Support filters as Toggle button
- Support filters as Dropdown/Context menu
- Broadcast events when filter state changes
The UI for it can be a mix of the input boxes from File Explorer and Notebook, and embedders can contribute dynamic filters and declare how they should be rendered (as Toggle or Dropdown) statically.
A draft for the interfaces of the new input box and its filters:
interface InputFilter {
value: boolean;
icon: Codicon;
isPrimary: boolean;
}
interface InputFilters {
[key: string]: InputFilter;
}
type FilterUpdateEvent<T> = { [K in keyof T]?: string };
interface InputWithFilters<T = InputFilters> {
filters: T;
onDidChangeFilter: Event<FilterUpdateEvent<T>>;
}The input box in the Notebook Find Widget can then be declared as
interface NotebookEditorFindInputFilters extends InputFilters {
caseSensitive: InputFilter;
wholeWord: InputFilter;
regex: InputFilter;
searchInMarkdown: InputFilter;
searchInOutput: InputFilter;
}
type NotebookEditorFindInput = InputWithFilters<NotebookEditorFindInputFilters>;
// notebook editor find input filter object
{
caseSensitive: { value: false, icon: Codicon.caseSensitive, isPrimary: true },
wholeWord: { value: false, icon: Codicon.wholeWord, isPrimary: true },
regex: { value: false, icon: Codicon.regex, isPrimary: true },
searchInMarkdown: { value: false, icon: Codicon.markdown, isPrimary: false },
searchInOutput: { value: false, icon: Codicon.output, isPrimary: false }
}cc João Moreno (@joaomoreno) Daniel Imms (@Tyriar) Andrea Mah (@andreamah) Matt Bierner (@mjbvz) feedbacks welcome!






Activity
miguelsolorio commentedon Jul 25, 2022
Love that we are tackling this problem! From a design perspective, I think we can establish some principles for how the interactions should work:
Things that are unclear so far:
Tyriar commentedon Aug 12, 2022
Here are what each of the inputs called out above are built from, plus the quick pick which we also want filter support for.
Text editor
Terminal
Webview
Problems
Notebook
File explorer
Quick pick
4 remaining items
Tyriar commentedon Aug 12, 2022
How about
ToggleandFilterTogglethen as they are toggles but will always live in a dropdown called "Filters"?I'm not sure we're currently that strict wrt options vs scopes. For the terminal anyway we're not sure whether we're going to have a toggle or a filter yet and the decision is currently coming down to are we able to get an icon to represent fuzzy search. I see all toggles and filters are just search options and/or modes, the main differentiator for me is whether they're important enough to be in the list vs in the filters dropdown.
With that said, maybe we should be strict about this and make "Toggles" = options/modes/how something is searched, and "Filter Toggles" = scope/where/what is searched? @misolori thoughts?
rebornix commentedon Aug 13, 2022
This makes good sense. If we are not trying to differentiate the functionalities of options in the list and the ones in the dropdown, then their difference is UI (where they get rendered), which is similar to Toolbar/ActionBar's primary/secondary grouping.
miguelsolorio commentedon Aug 15, 2022
To the user, it doesn't make much difference if an option is part of the input or in a dropdown, they are just "options", so I agree with this. I think in order to move into a dropdown there needs be more than one option.
Tyriar commentedon Aug 17, 2022
UX sync feedback:
rebornix commentedon Aug 18, 2022
Let's start one to ensure others who use find in selection in the team and Editor folks are aware of the coming UX changes.
Tyriar commentedon Aug 19, 2022
Peng Lyu (@rebornix) I'm a little surprised how positive the reception was, makes a lot more sense with your find in comments/string/brackets suggestion though. I forked that off to #158598 for you to tackle in a debt week
Change explorer filter icon to listFilter
Move showOptionButtons into IFindInputOptions.showCommonFindToggles
Adopt FindInput in QuickInputBox
Tyriar commentedon Aug 30, 2022
I tried this and had a bit of trouble making it nice. I suggest revisiting making it generic when we next look at adopting the dropdown in another
FindInput.