IBM / zopeneditor-about

IBM Z Open Editor: File issues here!
https://ibm.github.io/zopeneditor-about
Apache License 2.0
47 stars 25 forks source link

COBOL program wrapped in JCL #354

Closed LukasJaks closed 11 months ago

LukasJaks commented 11 months ago

Development environment used

Problem Description

Detailed steps for reproducing the problem:

  1. First step wrap cobol source program in JCL compile procedure
  2. manually select cobol as language

Observed behavior

Expected behavior

FALLAI-Denis commented 11 months ago

HI @LukasJaks,

I understand that your request concerns the support of several language modes in the same document.

VS Code allows this, but I think your request is too specific to your context and you will have to implement your own solution: you want to manage documents that use both the JCL language mode and the COBOL language mode, but the number of combinations of language mode is infinite, and the rules for switching from one language mode to another language mode can also be context-specific.

I invite you to read an article on Medium and the VS Code documentation:

There are two mechanisms that are implemented for processing a language mode:

To achieve your goal, you would have to develop a proprietary extension associated with a new "JCL + COBOL" language mode. This extension should:

In your case, it may not be necessary to implement the COBOL language server, the combination of JCL and COBOL syntax highlighting may be sufficient for your needs.

Regarding the appearance of red squiggle lines, to avoid them, the COBOL language server should be disabled to keep only the COBOL syntax highlighting. Another solution is to make them less intrusive, see:

sdaimwood commented 11 months ago

Hi @LukasJaks, while we support embedded CICS and SQL through the EXEC statement in COBOL, as @FALLAI-Denis mentioned, we do not support JCL wrapping in Z Open Editor or the JCL language with a language server. We do have a standalone JCL textmate, so JCL files should have syntax highlighting when opened, but no language functionality.

While not ideal, if you want to get rid of all red errors there is a setting to disable all reported problems in a program. To enable that, go to VS Code settings, the setting falls under Z Open Editor -> Cobol -> Disable problems. If you'd like to search for it, the setting ID is zopeneditor.cobol.disableProblems. The drawback of this is that real errors won't be reported, although I'm not sure in your case if any "real" errors were being reported anyway as the document almost certainly wasn't able to be parsed correctly with the JCL present.

LukasJaks commented 11 months ago

Hello,

@FALLAI-Denis thank you, for us, it will probably be solved by disabling the COBOL language server. As we dont need to have the JCL syntax highlighted. or if someone will complain, we will use @sdaimwood solution.

I guess we can now close this issue as resolved, even though, I still wonder why it's not being parsed correctly, one would think that just the JCL part would be in red lines, and the rest would be fine.

Thank you for your help though!

phaumer commented 11 months ago

@LukasJaks thanks for submitting this. We keep it in our radar, but I had not heard about this practice before. Our cobol language mode right now is strict as the language is very sensitive about every character and column a character is placed etc.