import { window , commands } from 'vscode' ; import * as fs from 'fs-extra' ; export async function showOpenSettingsPrompt ( errorMessage ) { const selected = await window . showErrorMessage ( errorMessage , 'Open settings' ) ; if ( selected === 'Open settings' ) { await commands . executeCommand ( 'workbench.action.openGlobalSettings' ) ; } } export async function showReportIssueErrorMessage ( errorMessage ) { const selected = await window . showErrorMessage ( errorMessage , 'Report Issue' ) ; if ( selected === 'Report Issue' ) { await commands . executeCommand ( 'psalm.reportIssue' ) ; } } export async function showErrorMessage ( errorMessage ) { return window . showErrorMessage ( errorMessage ) ; } export async function showWarningMessage ( errorMessage ) { return window . showWarningMessage ( errorMessage ) ; } export async function formatFromTemplate ( templatePath , ... args ) { const template = await fs . readFile ( templatePath , 'utf8' ) ; return template . replace ( /{(\d+)}/g , ( match , number ) => args [ number ] === undefined ? match : args [ number ] ) ; }