import { commands , Extension , extensions , window } from 'vscode' ; const azureDeploy = 'ms-vscode-deploy-azure.azure-deploy' ; const conflictingIDs = new Set ( [ 'vscoss.vscode-ansible' , azureDeploy , 'sysninja.vscode-ansible-mod' , 'haaaad.ansible' ] ) ; const uninstallingIDs = new Set ( ) ; /**
 * Get all of the installed extensions that currently conflict with VSCode-YAML
 */ export function getConflictingExtensions ( ) { const conflictingExtensions = [ ] ; conflictingIDs . forEach ( ( extension ) => { const ext = extensions . getExtension ( extension ) ; if ( ext && ! uninstallingIDs . has ( ext . id ) ) { conflictingExtensions . push ( ext ) ; } } ) ; return conflictingExtensions ; } /**
 * Display the uninstall conflicting extension notification if there are any conflicting extensions currently installed
 */ export function showUninstallConflictsNotification ( conflictingExts ) { for ( const extIndex in conflictingExts ) { const ext = conflictingExts [ extIndex ] ; uninstallingIDs . add ( ext . id ) ; } const uninstallMsg = 'Uninstall' ; let conflictMsg = '' ; if ( conflictingExts . length === 1 ) { conflictMsg = `${ conflictingExts [ 0 ] . packageJSON . displayName } extension is incompatible with VSCode-YAML. Please uninstall it.` ; } else { const extNames = [ ] ; conflictingExts . forEach ( ( ext ) => { extNames . push ( ext . packageJSON . displayName ) ; } ) ; conflictMsg = `The ${ extNames . join ( ', ' ) } extensions are incompatible with VSCode-YAML. Please uninstall them.` ; } if ( conflictingExts . length > 0 ) { window . showInformationMessage ( conflictMsg , uninstallMsg ) . then ( ( clickedMsg ) => { if ( clickedMsg === uninstallMsg ) { conflictingExts . forEach ( ( ext ) => { commands . executeCommand ( 'workbench.extensions.uninstallExtension' , ext . id ) ; uninstallingIDs . delete ( ext . id ) ; } ) ; if ( conflictingExts . findIndex ( ( ext ) => ext . id === azureDeploy ) !== - 1 ) { commands . executeCommand ( 'workbench.action.reloadWindow' ) ; } } } ) ; } }