export function wrapCommand ( command ) { return async function wrapped ( ... args ) { try { await command ( ... args ) ; } catch ( err ) { nova . workspace . showErrorMessage ( err ) ; } } ; } export async function openFile ( uri ) { const newEditor = await nova . workspace . openFile ( uri ) ; if ( newEditor ) { return newEditor ; } console . warn ( "failed first open attempt, retrying once" , uri ) ; return await nova . workspace . openFile ( uri ) ; }