Open EmmasBox opened 7 months ago
Thanks for submitting this request @EmmasBox. This will be a tricky one and it is really something we want VS Code to do this and not us. Here some thoughts:
files.associations
setting in VS Code that allows wildcards, which is quite powerful. Have you played with that?workbench.editor.languageDetection workbench.editor.historyBasedLanguageDetection workbench.editor.languageDetectionHints workbench.editor.preferHistoryBasedLanguageDetection
Have you played with these? I have no experience with them, but perhaps they work.zopeneditor.cobol.includeFileExtensions
etc.Hi,
The ISPF editor on z/OS implements language autodetection. The rules are available here: z/OS ISPF Edit and Edit Macros - Automatic language selection
I think the LPEX editor also uses language autodetection, and LPEX is available in IDz, (although it is deprecated).
Personally, I'm going to look at the suggested VS Code APIs to see if it would be possible to develop an extension that would do language autodetections:
The problem of language detection a priori only concerns files without extensions, and files retrieved via Zowe Explorer from z/OS which do not use an extension system. In other discussions, I have already pointed out that the current system is unsatisfactory and often gives false results. For example I use a hlq.COBOL.JCL PDS.... This PDS is wrongly detected as containing COBOL elements when it in fact contains JCL elements (COBOL compile JCL)... This because the analysis is done according to the order of the declarations made in the settings.json. This is why a content analysis would be more appropriate than an analysis of z/OS file names.
Another possibility would be to set priorities on the words (segments of dataset names) that make up a z/OS file name. For example :
If the dataset name has a segment that contains the word COBOL without any segment that contains the word JCL: it is a COBOL source If the dataset name has a segment that contains the word COBOL and also a segment that contains the word JCL: it is a JCL source
Another possibility would be for ZOE, or rather Zowe Explorer, to be "extensible": giving the possibility of subscribing to an event triggered by ZOE and creating a proprietary extension which intercepts this event and decides the language to associate with the file.
I like the idea of a Zowe Explorer API for extenders to inject an algorithm that adds file extensions to the downloaded files in the temp folder dynamically. Zowe Explorer itself must remain file type agnostic, but allowing language extension to provide solutions would be great.
Hi @phaumer,
With the current solution, described here, ZOE would have to take the values indicated in the zopeneditor.datasets.<language>Datasets
parameters as is, without adding a wildcard *
at the end to append in files.associations
, unlike what is currently done.
So in the zopeneditor.datasets.<language>Datasets
parameters, we would have the alternatives:
.COBOL
--> *.COBOL
for files.associations
*
character at the end of the pattern: .COBOL.*
--> *.COBOL.*
for files.associations
When I retrieve my JCL stored in datasets through Zowe Explorer VS Code does not automatically detect it as JCL, because it looks for file extensions, this problem applies to Rexx, COBOL, and PL/I as well. I have seen newcomers to VS Code assume it is unable to highlight mainframe languages such as JCL, Rexx, COBOL, and PL/I.
I propose IBM Z Open Editor implements auto detection of mainframe languages that doesn't rely on file extensions, instead it should look for indicators such as / Rexx / and //.