Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v2] Port fix for Open with Encoding quickpick #3377

Merged
merged 2 commits into from
Jan 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/zowe-explorer/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ All notable changes to the "vscode-extension-for-zowe" extension will be documen
- Fixed an issue where clicking on a file in the Unix System Services tree caused the tree to abruptly change focus to the selected item. [#2486](https://github.com/zowe/zowe-explorer-vscode/issues/2486)
- Fixed an issue where binary USS files were not fetched using the "Pull from Mainframe" context menu option. [#3355](https://github.com/zowe/zowe-explorer-vscode/issues/3355)
- Fixed an issue with Auto Save where a failed UNIX file or data set save operation caused an infinite loop of save requests. [#2406](https://github.com/zowe/zowe-explorer-vscode/issues/2406), [#2627](https://github.com/zowe/zowe-explorer-vscode/issues/2627)
- Fixed an issue where "Open with Encoding" menu failed when tagged encoding was selected for a binary USS file. [#3377](https://github.com/zowe/zowe-explorer-vscode/pull/3377)

## `2.18.0`

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -946,6 +946,23 @@ describe("Shared utils unit tests - function promptForEncoding", () => {
expect(blockMocks.showQuickPick.mock.calls[0][1]).toEqual(expect.objectContaining({ placeHolder: "Current encoding is Binary" }));
});

it("prompts for encoding for tagged USS binary file", async () => {
const blockMocks = createBlockMocks();
const node = new ZoweUSSNode({
label: "testFile",
collapsibleState: vscode.TreeItemCollapsibleState.None,
session: blockMocks.session,
profile: blockMocks.profile,
parentPath: "/root",
});
node.setEncoding(binaryEncoding);
blockMocks.showQuickPick.mockImplementationOnce(async (items) => items[0]);
const encoding = await sharedUtils.promptForEncoding(node, "binary");
expect(blockMocks.showQuickPick).toHaveBeenCalled();
expect(await blockMocks.showQuickPick.mock.calls[0][0][0]).toEqual({ label: "binary", description: "USS file tag" });
expect(encoding).toEqual({ kind: "binary" });
});

it("prompts for encoding for USS file when profile contains encoding", async () => {
const blockMocks = createBlockMocks();
(blockMocks.profile.profile as any).encoding = "IBM-1047";
Expand Down
2 changes: 1 addition & 1 deletion packages/zowe-explorer/src/shared/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,7 @@ export async function promptForEncoding(node: IZoweDatasetTreeNode | IZoweUSSTre
break;
default:
if (response != null) {
encoding = { kind: "other", codepage: response };
encoding = response === "binary" ? { kind: "binary" } : { kind: "other", codepage: response };
}
break;
}
Expand Down
Loading