import { QuickPickItem , QuickPickOptions , window } from "vscode" ; export class Item implements QuickPickItem { label : string ; description : string ; detail : string ; picked : boolean ; alwaysShow : boolean ; constructor ( name , desc , details , sticky = true , selected = false ) { this . label = name ; this . description = desc ; this . detail = details ; this . picked = selected ; this . alwaysShow = sticky ; } } export class Options implements QuickPickOptions { canPickMany : boolean ; ignoreFocusOut : boolean ; placeHolder : string ; constructor ( placeholder , ignoreDefocus = false , multiSelect = false ) { this . placeHolder = placeholder ; this . ignoreFocusOut = ignoreDefocus ; this . canPickMany = multiSelect ; } } export class QuickPick { static async pick < T extends Item , U extends Options > ( items , options ) { return QuickPick . showQuickPick ( items , options ) . then ( ( oneOrMany ) => { if ( oneOrMany ) { return options . canPickMany ? ( oneOrMany as T [ ] ) : [ oneOrMany as T ] ; } return [ ] ; } ) ; } static async showQuickPick < T extends QuickPickItem > ( items , options ) { return window . showQuickPick < T > ( items , options , undefined ) ; } }