Skip to content

Commit ba6aa48

Browse files
committed
Documentation (#49340)
1 parent db63841 commit ba6aa48

File tree

2 files changed

+187
-2
lines changed

2 files changed

+187
-2
lines changed

src/vs/vscode.proposed.d.ts

+185
Original file line numberDiff line numberDiff line change
@@ -523,90 +523,275 @@ declare module 'vscode' {
523523

524524
export namespace window {
525525

526+
/**
527+
* A back button for [QuickPick](#QuickPick) and [InputBox](#InputBox).
528+
*
529+
* When a navigation 'back' button is needed this one should be used for consistency.
530+
* It comes with a predefined icon, tooltip and location.
531+
*/
526532
export const quickInputBackButton: QuickInputButton;
527533

534+
/**
535+
* Creates a [QuickPick](#QuickPick) to let the user pick an item from a list
536+
* of items of type T.
537+
*
538+
* Note that in many cases the more convenient [window.showQuickPick](#window.showQuickPick)
539+
* is easier to use.
540+
*
541+
* @return A new [QuickPick](#QuickPick).
542+
*/
528543
export function createQuickPick<T extends QuickPickItem>(): QuickPick<T>;
529544

545+
/**
546+
* Creates a [InputBox](#InputBox) to let the user enter some text input.
547+
*
548+
* Note that in many cases the more convenient [window.showInputBox](#window.showInputBox)
549+
* is easier to use.
550+
*
551+
* @return A new [InputBox](#InputBox).
552+
*/
530553
export function createInputBox(): InputBox;
531554
}
532555

556+
/**
557+
* A light-weight user input UI that is intially not visible. After
558+
* configuring it through its properties the extension can make it
559+
* visible by calling [QuickInput.show](#QuickInput.show).
560+
*
561+
* There are several reasons why this UI might have to be hidden and
562+
* the extension will be notified through [QuickInput.onDidHide](#QuickInput.onDidHide).
563+
* (Examples include: an explict call to [QuickInput.hide](#QuickInput.hide),
564+
* the user pressing Esc, some other input UI opening, etc.)
565+
*
566+
* A user pressing Enter or some other gesture implying acceptance
567+
* of the current state does not automatically hide this UI component.
568+
* It is up to the extension to decide whether to accept the user's input
569+
* and if the UI should indeed be hidden through a call to [QuickInput.hide](#QuickInput.hide).
570+
*
571+
* When the extension no longer needs this input UI, it should
572+
* [QuickInput.dispose](#QuickInput.dispose) it to allow for freeing up
573+
* any resources associated with it.
574+
*
575+
* See [QuickPick](#QuickPick) and [InputBox](#InputBox) for concrete UIs.
576+
*/
533577
export interface QuickInput {
534578

579+
/**
580+
* An optional title.
581+
*/
535582
title: string | undefined;
536583

584+
/**
585+
* An optional current step count.
586+
*/
537587
step: number | undefined;
538588

589+
/**
590+
* An optional total step count.
591+
*/
539592
totalSteps: number | undefined;
540593

594+
/**
595+
* If the UI should allow for user input. Defaults to true.
596+
*
597+
* Change this to false, e.g., while validating user input or
598+
* loading data for the next step in user input.
599+
*/
541600
enabled: boolean;
542601

602+
/**
603+
* If the UI should show a progress indicator. Defaults to false.
604+
*
605+
* Change this to true, e.g., while loading more data or validating
606+
* user input.
607+
*/
543608
busy: boolean;
544609

610+
/**
611+
* If the UI should stay open even when loosing UI focus. Defaults to false.
612+
*/
545613
ignoreFocusOut: boolean;
546614

615+
/**
616+
* Makes the input UI visible in its current configuration. Any other input
617+
* UI will first fire an [QuickInput.onDidHide](#QuickInput.onDidHide) event.
618+
*/
547619
show(): void;
548620

621+
/**
622+
* Hides this input UI. This will also fire an [QuickInput.onDidHide](#QuickInput.onDidHide)
623+
* event.
624+
*/
549625
hide(): void;
550626

627+
/**
628+
* An event signaling when this input UI is hidden.
629+
*
630+
* There are several reasons why this UI might have to be hidden and
631+
* the extension will be notified through [QuickInput.onDidHide](#QuickInput.onDidHide).
632+
* (Examples include: an explict call to [QuickInput.hide](#QuickInput.hide),
633+
* the user pressing Esc, some other input UI opening, etc.)
634+
*/
551635
onDidHide: Event<void>;
552636

637+
/**
638+
* Dispose of this input UI and any associated resources. If it is still
639+
* visible, it is first hidden. After this call the input UI is no longer
640+
* functional and no additional methods or properties on it should be
641+
* accessed. Instead a new input UI should be created.
642+
*/
553643
dispose(): void;
554644
}
555645

646+
/**
647+
* A concrete [QuickInput](#QuickInput) to let the user pick an item from a
648+
* list of items of type T. The items can be filtered through a filter text field and
649+
* there is an option [canSelectMany](#QuickPick.canSelectMany) to allow for
650+
* selecting multiple items.
651+
*
652+
* Note that in many cases the more convenient [window.showQuickPick](#window.showQuickPick)
653+
* is easier to use.
654+
*/
556655
export interface QuickPick<T extends QuickPickItem> extends QuickInput {
557656

657+
/**
658+
* Current value of the filter text.
659+
*/
558660
value: string;
559661

662+
/**
663+
* Optional placeholder in the filter text.
664+
*/
560665
placeholder: string | undefined;
561666

667+
/**
668+
* An event signaling when the value of the filter text has changed.
669+
*/
562670
readonly onDidChangeValue: Event<string>;
563671

672+
/**
673+
* An event signaling when the user indicated acceptance of the selected item(s).
674+
*/
564675
readonly onDidAccept: Event<void>;
565676

677+
/**
678+
* Buttons for actions in the UI.
679+
*/
566680
buttons: ReadonlyArray<QuickInputButton>;
567681

682+
/**
683+
* An event signaling when a button was triggered.
684+
*/
568685
readonly onDidTriggerButton: Event<QuickInputButton>;
569686

687+
/**
688+
* Items to pick from.
689+
*/
570690
items: ReadonlyArray<T>;
571691

692+
/**
693+
* If multiple items can be selected at the same time. Defaults to false.
694+
*/
572695
canSelectMany: boolean;
573696

697+
/**
698+
* If the filter text should also be matched against the description of the items. Defaults to false.
699+
*/
574700
matchOnDescription: boolean;
575701

702+
/**
703+
* If the filter text should also be matched against the detail of the items. Defaults to false.
704+
*/
576705
matchOnDetail: boolean;
577706

707+
/**
708+
* Active items. This can be read and updated by the extension.
709+
*/
578710
activeItems: ReadonlyArray<T>;
579711

712+
/**
713+
* An event signaling when the active items have changed.
714+
*/
580715
readonly onDidChangeActive: Event<T[]>;
581716

717+
/**
718+
* Selected items. This can be read and updated by the extension.
719+
*/
582720
selectedItems: ReadonlyArray<T>;
583721

722+
/**
723+
* An event signaling when the selected items have changed.
724+
*/
584725
readonly onDidChangeSelection: Event<T[]>;
585726
}
586727

728+
/**
729+
* A concrete [QuickInput](#QuickInput) to let the user input a text value.
730+
*
731+
* Note that in many cases the more convenient [window.showInputBox](#window.showInputBox)
732+
* is easier to use.
733+
*/
587734
export interface InputBox extends QuickInput {
588735

736+
/**
737+
* Current input value.
738+
*/
589739
value: string;
590740

741+
/**
742+
* Optional placeholder in the filter text.
743+
*/
591744
placeholder: string | undefined;
592745

746+
/**
747+
* If the input value should be hidden. Defaults to false.
748+
*/
593749
password: boolean;
594750

751+
/**
752+
* An event signaling when the value has changed.
753+
*/
595754
readonly onDidChangeValue: Event<string>;
596755

756+
/**
757+
* An event signaling when the user indicated acceptance of the input value.
758+
*/
597759
readonly onDidAccept: Event<void>;
598760

761+
/**
762+
* Buttons for actions in the UI.
763+
*/
599764
buttons: ReadonlyArray<QuickInputButton>;
600765

766+
/**
767+
* An event signaling when a button was triggered.
768+
*/
601769
readonly onDidTriggerButton: Event<QuickInputButton>;
602770

771+
/**
772+
* An optional prompt text providing some ask or explanation to the user.
773+
*/
603774
prompt: string | undefined;
604775

776+
/**
777+
* An optional validation message indicating a problem with the current input value.
778+
*/
605779
validationMessage: string | undefined;
606780
}
607781

782+
/**
783+
* Button for an action in a [QuickPick](#QuickPick) or [InputBox](#InputBox).
784+
*/
608785
export interface QuickInputButton {
786+
787+
/**
788+
* Icon for the button.
789+
*/
609790
readonly iconPath: string | Uri | { light: string | Uri; dark: string | Uri } | ThemeIcon;
791+
792+
/**
793+
* An optional tooltip.
794+
*/
610795
readonly tooltip?: string | undefined;
611796
}
612797

src/vs/workbench/browser/parts/quickinput/quickInput.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -285,8 +285,8 @@ class QuickPick<T extends IQuickPickItem> extends QuickInput implements IQuickPi
285285
private _items: T[] = [];
286286
private itemsUpdated = false;
287287
private _canSelectMany = false;
288-
private _matchOnDescription = true;
289-
private _matchOnDetail = true;
288+
private _matchOnDescription = false;
289+
private _matchOnDetail = false;
290290
private _activeItems: T[] = [];
291291
private activeItemsUpdated = false;
292292
private onDidChangeActiveEmitter = new Emitter<T[]>();

0 commit comments

Comments
 (0)