zowe / zowe-explorer-vscode

Visual Studio Code Extension for Zowe, which lets users interact with z/OS Data Sets, Unix System Services, and Jobs on a remote mainframe instance. Powered by Zowe SDKs.
Eclipse Public License 2.0
173 stars 92 forks source link

V3.0.0 File extension detection misidentifies types #3181

Closed JPeake42 closed 1 month ago

JPeake42 commented 1 month ago

Describe the bug

Some datasets are misidentified as file types they are not. E.g 'USERID.A.OUTPUT' being detected as '.ASM'. This leads to VS Code setting the language mode according to the incorrect file type.

To Reproduce

  1. Open a dataset with a single character qualifier, but without an obvious type identifier, e.g USERID.A.OUTPUT, USERID.J.TEST
  2. File type will be appended to dataset, e.g "USERID.A.OUTPUT" becomes "USERID.A.OUTPUT.asm", "USERID.J.TEST" becomes "USERID.J.TEST.jcl".

Expected behavior

File extensions would only be appended to obviously named data sets, e.g "USERID.SOMETHING.JCL" or "USERID.SOMETHING.COBOL".

Desktop (please complete the following information):

Additional context

I think this is due to changes to the DatasetUtils.ts file in eb06448. The getExtension function is checking if any qualifier is present in each 'match' instead of in the 'matches' array. Before, only qualifiers such as 'JCL' or 'COBOL' would be picked up, but now if a qualifier contains a subset of either, they would be considered.

Additionally, in previous versions, VS Codes "files.associations" setting could be used to allow users to finetune what datasets should be considered what types, though with changes in v3.0.0, this seems to not work anymore for members (Though this may be a separate issue I suppose).

Apologies if I'm missing anything, I don't frequent github / projects, so I hope the above is sufficient context.

github-actions[bot] commented 1 month ago

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.

traeok commented 1 month ago

Hi @JPeake42,

Thanks for bringing this to our attention and my apologies for the oversight. @t1m0thyj implemented a fix for this and it should be available in v3.0.1.

Regarding the files.associations change in behavior: this is likely due to the change in path structure for PDS members. Before, we had inserted the member name into the file in parentheses (ex: TEST.COBOL(MEMB1)) vs. the new path structure TEST.COBOL/MEMB1. For v3, you'll need to adjust your associations so that they also support PDS members. Here are some example globs for reference:

**/*COBOL*{,/*} - matches /lpar.zosmf/TEST.COBOL.PS and /lpar.zosmf/TEST.COBOL.PDS/MEMBER
**/*JCL*{,/*} - matches /lpar.zosmf/TEST.JCL.PS and /lpar.zosmf/TEST.JCL.PDS/EXAMPLE

We'll make sure our documentation is updated so others are aware of this change.

phaumer commented 1 month ago

I don't think Zowe Explorer should make any assumptions about languages content. This should be the job of language VS Code extensions that are typically installed on top of Zowe Explorer. If Zowe Explorer already intercepts this and guess wrong then it leads to a bad user experience.

I am looking for upvotes on my issue https://github.com/zowe/zowe-explorer-vscode/issues/3131 @JPeake42

JPeake42 commented 1 month ago

Thank you both for the quick response and fix @traeok / @t1m0thyj! That formatting for the files.associations setting works like a charm as well.

I hope I've upvoted your issue correctly @phaumer, I agree that it seems sensible that Zowe leaves it to the language extensions to figure out what a file is. The files.associations settings let users manage it a bit anyway.