import { MessageItem , window } from "vscode" ; import { MessageTypes } from "../bll/utils/constants" ; import { injectable } from "inversify" ; @ injectable ( ) export class MessageManager { public async showInfoMessage ( messageToDisplay , ... messageItems ) { return MessageManager . showMessage ( messageToDisplay , MessageTypes . Info , ... messageItems ) ; } public async showWarningMessage ( messageToDisplay , ... messageItems ) { return MessageManager . showMessage ( messageToDisplay , MessageTypes . Warn , ... messageItems ) ; } public async showErrorMessage ( messageToDisplay , ... messageItems ) { return MessageManager . showMessage ( messageToDisplay , MessageTypes . Error , ... messageItems ) ; } private static async showMessage ( message , type , ... messageItems ) { const messageToDisplay = `${ message }` ; let chosenItem ; switch ( type ) { case MessageTypes . Error : chosenItem = await window . showErrorMessage ( messageToDisplay , ... messageItems ) ; break ; case MessageTypes . Info : chosenItem = await window . showInformationMessage ( messageToDisplay , { modal : false } , ... messageItems ) ; break ; case MessageTypes . Warn : chosenItem = await window . showWarningMessage ( messageToDisplay , ... messageItems ) ; break ; default : break ; } return chosenItem ; } }