diff --git a/spec/atom-environment-spec.js b/spec/atom-environment-spec.js index 2a44b24042..4a896ec51d 100644 --- a/spec/atom-environment-spec.js +++ b/spec/atom-environment-spec.js @@ -764,7 +764,12 @@ describe('AtomEnvironment', () => { expect(atom.notifications.addWarning).toHaveBeenCalledWith( 'Unable to open project folders', { - description: `The directories \`${nonExistent}\` and \`${existingFile}\` do not exist.` + description: `The directories \`${nonExistent}\` and \`${existingFile}\` do not exist.`, + dismissable: true, + buttons: [ + { text: 'Remove all', onDidClick: jasmine.any(Function) }, + { text: 'Skip for now', onDidClick: jasmine.any(Function) } + ] } ); }); diff --git a/src/atom-environment.js b/src/atom-environment.js index 510970615c..3cc535de51 100644 --- a/src/atom-environment.js +++ b/src/atom-environment.js @@ -1739,7 +1739,36 @@ or use Pane::saveItemAs for programmatic saving.`); '` do not exist.'; } - this.notifications.addWarning(message, { description }); + let notification; + + let removeMissingPaths = async () => { + this.applicationDelegate.setProjectRoots(this.project.getPaths()); + + for (const missingFolder of missingFolders) { + const { pathToOpen } = missingFolder; + + this.notifications.addWarning(`Removed ${pathToOpen}`); + } + + if (notification) { + notification.dismiss(); + } + }; + + let skipRemove = () => { + if (notification) { + notification.dismiss(); + } + } + + notification = this.notifications.addWarning(message, { + description, + dismissable: true, + buttons: [ + { text: 'Remove all', onDidClick: removeMissingPaths }, + { text: 'Skip for now', onDidClick: skipRemove } + ] + }); } ipcRenderer.send('window-command', 'window:locations-opened');