import * as path from "path" ; import * as vscode from "vscode" ; import { shell } from "./shell" ; param extensionId export async function installVscodeExtension ( extensionId ) { const vscodeCliPath = path . join ( path . dirname ( process . argv0 ) , "bin" , "code" ) ; const shellResult = await shell . exec ( `"${ vscodeCliPath }" --install-extension ${ extensionId }` ) ; if ( shellResult && shellResult . code === 0 ) { const answer = await vscode . window . showInformationMessage ( `Extension '${ extensionId }' was successfully installed. Reload to enable it.` , "Reload Now" ) ; if ( answer === "Reload Now" ) { await vscode . commands . executeCommand ( "workbench.action.reloadWindow" ) ; return true ; } } return false ; } export function isNonEmptyArray ( value ) { if ( value && value . length ) { return true ; } return false ; }