Skip to content

Commit

Permalink
WIP: Improve "Project does not exists" popup with a Remove all button…
Browse files Browse the repository at this point in the history
… to clean up the unreachable projects
  • Loading branch information
kiskoza committed Mar 13, 2024
1 parent 7d2d876 commit 733bf61
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 2 deletions.
7 changes: 6 additions & 1 deletion spec/atom-environment-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) }
]
}
);
});
Expand Down
31 changes: 30 additions & 1 deletion src/atom-environment.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down

0 comments on commit 733bf61

Please sign in to comment.