Commit Graph
3 Commits
Author SHA1 Message Date
Johan Bay 89a7ef9f2d Typecheck quick_open/QuickInput.js with TypeScript
Bug: 1011811
Change-Id: Id5edf7d0874f598f214709d9c884ec06c29e4bfd
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2443616
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
Commit-Queue: Johan Bay <jobay@google.com>
2020-10-02 10:12:50 +00:00
Jan Scheffler 20be618209 Migrate front_end/quick_open to devtools_entrypoint
R=aerotwist@chromium.org, jacktfranklin@chromium.org

Bug: 1101738
Change-Id: I648c66df53f70f59392ebfa8d7e9cfb199098fb1
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2323629
Commit-Queue: Jan Scheffler <janscheffler@chromium.org>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
Auto-Submit: Jan Scheffler <janscheffler@chromium.org>
2020-07-29 14:13:11 +00:00
Rob Paveza 9e33bc96e1 Added a QuickPick and QuickInput UI modality.
QuickOpen is a highly-useful UI affordance for the DevTools. However,
the actual implementation introduces some problems with reusability;
the QuickOpen tool is a global DevTools singleton that coalesces
multiple "Providers" across DevTools to handle activities like Go To
Line, Open document, or Invoke Command. Because it is a singleton, a
developer who wanted to leverage that input modality would need to drop
to the FilteredListWidget, which is tightly coupled to the QuickOpen
implementation and also has a non-obvious implementation pattern (one
would need to implement a Provider, and there is no straightforward way
to observe when the user cancels out of it).

This change borrows a simplified version of the VS Code QuickPick and
QuickInput APIs. With this, a DevTools developer can write a single
line, using an awaitable, so that the meaning and purpose of the input
collection is straightforward:

    const text = await QuickInput.show({
      prompt: 'Please enter some information.',
      value: 'A default value',
      valueSelection: [0, 15],
    });
    // text will contain the entered value, or undefined

QuickPick requires a few more lines to implement, but provides a
similarly easy-to-use interface:

    const demoMenu1 = [
      {
        label: 'Item 1',
      },
      {
        label: 'Item 2',
      },
      {
        label: 'Item 3',
      }
    ];
    const choice = await QuickPick.show(demoMenu1, {
      placeHolder: 'Choose from these options:'
    });
    // choice contains one of the objects from demoMenu1, or undefined

The explainer can be found here:
https://docs.google.com/document/d/1EibIlPCeH-672wncOScGoMbSs0EzNY4SSaqJng-5-S4/edit#

... and GIFs of these in action can be found here:
https://imgur.com/a/GCfpHQ3

Bug: 1103402
Change-Id: I1ca7c7c87243553ff45d00369ce8996c2914be93
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2288530
Reviewed-by: Brandon Goddard <brgoddar@microsoft.com>
Commit-Queue: Robert Paveza <Rob.Paveza@microsoft.com>
2020-07-13 22:12:49 +00:00