diff --git a/packages/zowe-explorer/src/utils/TreeViewUtils.ts b/packages/zowe-explorer/src/utils/TreeViewUtils.ts index 57a5a5b887..564fa9a15b 100644 --- a/packages/zowe-explorer/src/utils/TreeViewUtils.ts +++ b/packages/zowe-explorer/src/utils/TreeViewUtils.ts @@ -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; } }