import { VSCodeWindow } from "./vscode.interfaces" ; import { InputBoxOptions , QuickPickOptions , QuickPickItem } from "vscode" ; export class UserActions { constructor ( private window ) { } async showInfo ( text ) { await this . window . showInformationMessage ( text ) ; } async showError ( text ) { await this . window . showErrorMessage ( text ) ; } async promptAsync ( text , placeHolder , validator ) { const options = { ignoreFocusOut : true , placeHolder : placeHolder , validateInput : validator , prompt : text , } ; return await this . window . showInputBox ( options ) ; } async pickAsync ( text , items ) { const options = { ignoreFocusOut : true , placeHolder : text } ; const quickPicks = [ ] ; for ( const item of items ) { quickPicks . push ( { label : item , alwaysShow : true } ) ; } const pick = await this . window . showQuickPick ( quickPicks , options ) ; return pick ? pick . label : null ; } }