import * as vscode from 'vscode' ; export function randomFilePath ( args ) { const fileName = rndName ( ) ; return vscode . Uri . joinPath ( args . root , fileName + args . ext ) ; } export function rndName ( ) { let name = '' ; const possible = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789' ; for ( let i = 0 ; i < 10 ; i ++ ) { name += possible . charAt ( Math . floor ( Math . random ( ) * possible . length ) ) ; } return name ; } export function closeAllEditors ( ) { return vscode . commands . executeCommand ( 'workbench.action.closeAllEditors' ) ; } export function disposeAll ( disposables ) { vscode . Disposable . from ( ... disposables ) . dispose ( ) ; } export function delay ( ms ) { return new Promise ( resolve => setTimeout ( resolve , ms ) ) ; }