import { Disposable , FileSystemWatcher , workspace } from 'vscode' ; import { AzExtTreeItem , callWithTelemetryAndErrorHandling , IActionContext } from 'vscode-azureextensionui' ; export function createRefreshFileWatcher ( ti , globPattern ) { const refreshMethod = async ( ) : Promise < void > => { await callWithTelemetryAndErrorHandling ( 'refreshFileWatcher' , async ( context ) => { context . errorHandling . suppressDisplay = true ; context . telemetry . suppressIfSuccessful = true ; await ti . refresh ( context ) ; } ) ; } ; const watcher = workspace . createFileSystemWatcher ( globPattern ) ; return Disposable . from ( watcher , watcher . onDidChange ( refreshMethod ) , watcher . onDidCreate ( refreshMethod ) , watcher . onDidDelete ( refreshMethod ) ) ; }