Skip to content

Common input box with filters #156179

Closed
Closed

Description

@rebornix

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

image

Terminal

  • 3 built-in filters only

image

Webview

  • Built-in filters all disabled/hidden

image

File Explorer

  • Built-in filters disabled/hidden
  • Additional filter shown as a toggle inside the input box

image

Notebook

  • 3 built-in filters only
  • Additional filters shown in a dropdown/context menu

image

Problems

  • Multiple filters which are specific to Problems only

image

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

  1. added
    debt
    ux
    on Jul 25, 2022
  2. added this to the On Deck milestone on Jul 25, 2022
  3. miguelsolorio commented on Jul 25, 2022

    @miguelsolorio
    Contributor

    Love that we are tackling this problem! From a design perspective, I think we can establish some principles for how the interactions should work:

    • Actions with on/off states become "toggles"
    • Dropdown menu options that provide toggle options should use the generic "filter" icon
    • Dropdown menu options that change the input (like adding queries) become "actions" and don't require an on/off state

    Things that are unclear so far:

    • Should dropdown "actions" use a different icon or use the same?
    • Should in-context find widgets appear differently than search/filter inputs?
  4. Tyriar commented on Aug 12, 2022

    @Tyriar
    Contributor

    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

    FindWidget                        editor/contrib/find/browser/findWidget.ts
      FindInput                       base/browser/ui/findinput/findInput.ts
        HistoryInputBox               base/browser/ui/inputbox/inputBox.ts
          InputBox                    base/browser/ui/inputbox/inputBox.ts
    

    Terminal

    TerminalFindWidget                workbench/contrib/terminal/browser/terminalFindWidget.ts
      SimpleFindWidget                workbench/contrib/codeEditor/browser/find/simpleFindWidget.ts
        FindInput                     base/browser/ui/findinput/findInput.ts
          HistoryInputBox             base/browser/ui/inputbox/inputBox.ts
            InputBox                  base/browser/ui/inputbox/inputBox.ts
    

    Webview

    WebviewFindWidget                 workbench/contrib/webview/browser/webviewFindWidget.ts
      SimpleFindWidget                workbench/contrib/codeEditor/browser/find/simpleFindWidget.ts
        FindInput                     base/browser/ui/findinput/findInput.ts
          HistoryInputBox             base/browser/ui/inputbox/inputBox.ts
            InputBox                  base/browser/ui/inputbox/inputBox.ts
    

    Problems

    ActionBar                         base/browser/ui/actionbar/actionbar.ts
      MarkersFilterActionViewItem     workbench/contrib/markers/browser/markersViewActions.ts
        ContextScopedHistoryInputBox  platform/history/browser/contextScopedHistoryWidget.ts
          HistoryInputBox             base/browser/ui/inputbox/inputBox.ts
            InputBox                  base/browser/ui/inputbox/inputBox.ts
    

    Notebook

    NotebookFindWidget                workbench/contrib/notebook/browser/contrib/find/notebookFindWidget.ts
      SimpleFindReplaceWidget         workbench/contrib/notebook/browser/contrib/find/notebookFindReplaceWidget.ts
        NotebookFindInput             workbench/contrib/notebook/browser/contrib/find/notebookFindReplaceWidget.ts
          FindInput                   base/browser/ui/findinput/findInput.ts
            HistoryInputBox           base/browser/ui/inputbox/inputBox.ts
              InputBox                base/browser/ui/inputbox/inputBox.ts
    

    File explorer

    FindController                    base/browser/ui/tree/abstractTree.ts
      FindWidget                      base/browser/ui/tree/abstractTree.ts
        FindInput                     base/browser/ui/findinput/findInput.ts
          HistoryInputBox             base/browser/ui/inputbox/inputBox.ts
            InputBox                  base/browser/ui/inputbox/inputBox.ts
    

    Quick pick

    QuickInputBox                     base/parts/quickinput/browser/quickInputBox.ts
      InputBox                        base/browser/ui/inputbox/inputBox.ts
    
  5. 4 remaining items

  6. Tyriar commented on Aug 12, 2022

    @Tyriar
    Contributor

    I'm not sure about if we are calling them Toggle/Filter, as Toggle is referring to the UI/UX, while Filter is referring to the functionality.

    How about Toggle and FilterToggle then as they are toggles but will always live in a dropdown called "Filters"?

    caseSensitivity/matchingWord/regex are about how we match queries (SearchOptions) and additional filters are about where we search (SearchScopes).

    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?

  7. rebornix commented on Aug 13, 2022

    @rebornix
    ContributorAuthor

    the main differentiator for me is whether they're important enough to be in the list vs in the filters dropdown

    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.

  8. miguelsolorio commented on Aug 15, 2022

    @miguelsolorio
    Contributor

    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.

    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.

  9. Tyriar commented on Aug 17, 2022

    @Tyriar
    Contributor

    UX sync feedback:

    • No pushback on find in selection being in the filters dropdown, though that point might have been buried under all the other things I was talking about. Peng Lyu (@rebornix) we should do a ux channel poll to gauge interest if you want to follow that up
    • Consensus seemed to be 👍 to strict division of search modes vs filters dropdown
  10. rebornix commented on Aug 18, 2022

    @rebornix
    ContributorAuthor

    No pushback on find in selection being in the filters dropdown, though that point might have been buried under all the other things I was talking about. Peng Lyu (@rebornix) we should do a ux channel poll to gauge interest if you want to follow that up

    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.

  11. Tyriar commented on Aug 19, 2022

    @Tyriar
    Contributor

    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

  12. Tyriar commented on Aug 30, 2022

    @Tyriar
    Contributor

    Move the filters dropdown as implemented by DropdownMenuActionViewItem to be managed inside FindInput

    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.

  13. locked and limited conversation to collaborators on Oct 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

debtux

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions