Skip to content

Commit

Permalink
refactor: shorten logic in promptedForUnsavedResource
Browse files Browse the repository at this point in the history
Signed-off-by: Trae Yelovich <[email protected]>
  • Loading branch information
traeok committed Nov 18, 2024
1 parent 00369a4 commit 91bd557
Showing 1 changed file with 11 additions and 14 deletions.
25 changes: 11 additions & 14 deletions packages/zowe-explorer/src/utils/TreeViewUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,20 +130,17 @@ export class TreeViewUtils {

for (const doc of openedTextDocuments) {
const docIsChild = SharedUtils.checkIfChildPath(currentFilePath, doc.fileName);
if (doc.fileName === currentFilePath || docIsChild === true) {
if (doc.isDirty === true) {
Gui.errorMessage(
l10n.t({
message:
"Unable to rename {0} because you have unsaved changes in this {1}. " +
"Please save your work before renaming the {1}.",
args: [node.label, nodeType],
comment: ["Node path", "Node type (directory, file or data set)"],
}),
{ vsCodeOpts: { modal: true } }
);
return true;
}
if ((doc.fileName === currentFilePath || docIsChild) && doc.isDirty) {
Gui.errorMessage(
l10n.t({
message:
"Unable to rename {0} because you have unsaved changes in this {1}. " + "Please save your work before renaming the {1}.",
args: [node.label, nodeType],
comment: ["Node path", "Node type (directory, file or data set)"],
}),
{ vsCodeOpts: { modal: true } }
);
return true;
}
}

Expand Down

0 comments on commit 91bd557

Please sign in to comment.