IBM / zopeneditor-about

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

COBOL - Improve conditional compilation support (syntax highlighting) #88

Open FALLAI-Denis opened 3 years ago

FALLAI-Denis commented 3 years ago

Description of the enhancement requested

Currently the syntax highlighting of compilation directives, in particular conditional compilation directives, is not uniform.

On my VS Code configuration (with default options):

We suggest that compilation directives, and in particular conditional compilation directives, use specific syntax highlighting that clearly distinguishes them from COBOL source code. For example :

Is it possible to change the syntax highlighting for some COBOL elements yourself? And if yes, how ?

ZOE-DirectiveSyntaxHighlight-1

gplambert commented 3 years ago

@FALLAI-Denis Thanks for the feedback. We are looking at how we can improve syntax highlighting, one of the issues we come against is VS Code uses Textmate for syntax highlighting which has some limitations for situations like this. We will label this as a bug and continue our research.

FALLAI-Denis commented 2 years ago

Hi,

Regarding the colorization of conditional compilation directives, I found the origin of the problem in the textmate grammar.

for >>if, >>else, >>end-if: image

for all other directives of the form >>xxxx: image

I think this could be corrected by a rule of the form: image

kkrein commented 2 years ago

Ich bin derzeit nicht im Büro. Ich kehre zurück am 03.01.2022. Während meiner Abwesenheit bitte bei Postkorb SCM-Admin melden!

Die Rückmeldung bezieht sich auf ein Mail mit folgendem Thema: Re: [IBM/zopeneditor-about] COBOL - Improve conditional compilation support (syntax highlighting) (#88)


Gesendet (c) GRZ/RSG Linz 2021 Agent 'Abwesenheit'


Raiffeisen Software GmbH Firmenbuchnummer: 86804d, Landesgericht Linz UID: ATU 36961105

Der Austausch von Nachrichten mit dem oben angeführten Absender via E-Mail dient ausschließlich Informationszwecken. Rechtsgeschäftliche Erklärungen dürfen über dieses Medium nicht ausgetauscht werden. Correspondence with above mentioned sender via e-mail is only for information purposes. This medium is not to be used for the exchange of legally-binding communications.

FALLAI-Denis commented 1 year ago

Hi,

Problem still present in ZOE 3.0.0.

Also missing new compiler directive for IBM Enterprise COBOL V6R4: >>data

Correction suggestion:

      {"match": "(?<=^.{6})\\ +(>>(?i:DATA|DEFINE|ELSE|(?:(?:END-)?EVALUATE)|(?:(?:END-)?IF)|INLINE|WHEN)\\b)",
       "name": "meta.preprocessor.cobol strong"
      },
      {"match": "(?<=^.{6})\\ {5,}+(>>(?i:(?:CALLINT(?:ERFACE)?))\\b)",
       "name": "meta.preprocessor.cobol strong"
      },

Tested by modifying current cobol.json file: image

FALLAI-Denis commented 10 months ago

Hi,

Problem still present in ZOE 3.1.1... 😢

    {
      "match": "\\$(?i:if|else|then|display|xfd|end)(.*$)",   <-- ok for Microfocus, gnuCOBOL... specific syntaxe...
      "name": "meta.preprocessor"
    },
    {
      "match": "(?:^|\\s+)>>(?i:if|else|elif|end-if)(?:$|\\s.*$)", <-- wrong for ISO COBOL, IBM... standard syntaxe (not >>elif)... missing other directives...
      "name": "invalid.illegal.cobol"
    },

Proposal:

      "match": "(?:^|\\s+)(>>(?i:callint(?:erface)|data|define|if|inline|else|end-evaluate|end-if|evaluate|when))($|\\s.*$)",
      "captures": {
        "1": {
          "name": "keyword.control.directive.cobol emphasis"
        },
        "2": {
          "name": "comment.line.directive.cobol emphasis"
        }
      }
    },
    {
      "match": "(?:^|\\s+)>>(?i:elif)(?:$|\\s.*$)",
      "name": "invalid.illegal.cobol"
    },

giving: image

FALLAI-Denis commented 6 months ago

Hi,

The coloring of conditional compilation directives is still not uniform. Furthermore, some of our developers are disturbed by the presence of conditional compilation directives in the source code. We would like a neutral, low-intensity color, such as medium gray, to be applied to all compilation directives.

Thanks.