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

OpenRecentMember command problems #3447

Open
JWaters02 opened this issue Feb 8, 2025 · 1 comment
Open

OpenRecentMember command problems #3447

JWaters02 opened this issue Feb 8, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@JWaters02
Copy link
Member

JWaters02 commented Feb 8, 2025

Describe the bug

There are two parts to this bug:

  1. The keybinding to open it does not work
  2. The function itself does not work (special edge case!)

Part 1

When I use the keybinding ctrl+alt+r to run the command zowe.openRecentMember, nothing happens.

However, the keybinding (ctrl+alt+p) does work for its cousin, the command zowe.searchInAllLoadedItems, despite their entries in package.json being identical.

For the benefit of the doubt, I temporarily switched the zowe.searchInAllLoadedItems command to run the openRecentMemberPrompt function, and when pressing that keybind (ctrl+alt+p), it opened fine.

Perhaps some kind of key conflict? These are my keys:

Image

Part 2

Once I got the function running using that temporary switch as above, the menu would appear with all the files in my history as expected, however, when selecting a file, I always get the warning message Cannot read properties of undefined (reading 'pattern').

I debugged the issue and found that the sessionNode was not being found in my profile, which dropped through the code as null and eventually lead to this warning. sessionNode is not being found in my profile because my profile name is now simply different to how it is in the file history, which is where the recent files quick pick gets its items from.

Much easier to show a screenshot, so here, you can see that my current profile name is zosmf_zxplore, while the profile name that is being expected, is zxplore.

Image

However, you may notice, that in the above screenshot, the USS file in history and my USS profile name is the same. So why is it still not working then?

Because of a seperate oversight in the code:

const sessionNode = ussTree.mSessionNodes.find((sessNode) => sessNode.getProfileName() === sessionName);

The file history stores the profile name in all caps, while my profile name is in all lower, so it is checking all caps profile name with all lower one and does not find a match, so sessionNode is also not being found. Notice that this is not an issue for a matching dataset profile though, because it does actually do the lower case conversion for both first!

https://github.com/zowe/zowe-explorer-vscode/blame/eeeaf84a62a0a83b076b49e6bc7a1eb5ed9f0abc/packages/zowe-explorer/src/trees/shared/SharedActions.ts#L195

To Reproduce

Steps to reproduce the behavior:

  1. Open a profile
  2. Use ctrl+alt+r
  3. See that nothing happens

Expected behavior

For part 1: The open recent members prompt to appear.
For part 2: Proper handling of finding the sessionNode.

Screenshots

Desktop (please complete the following information):

  • OS: Win10
  • Zowe Explorer Version: v3.1.0
  • (Optional) Zowe CLI Version:
  • (Optional) Are you using Secure Credential Store?

Additional context

Not sure how to fix part 1, but part 2 should be straight forward plus a few test cases too.

For a bit of fun, I found the PR that originally added this function, it is virtually untouched except for someone who must've added that cases handling to the dataset part but not the uss part 😄

@JWaters02 JWaters02 added the bug Something isn't working label Feb 8, 2025
Copy link

github-actions bot commented Feb 8, 2025

Thank you for creating a bug report.
We will investigate the bug and evaluate its impact on the product.
If you haven't already, please ensure you have provided steps to reproduce the bug and as much context as possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: New Issues
Development

No branches or pull requests

1 participant