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

COBOL formatter - Wrongly excluding lines under conditional compilation control #425

Open
FALLAI-Denis opened this issue Jul 9, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@FALLAI-Denis
Copy link

FALLAI-Denis commented Jul 9, 2024

Hi,

For the COBOL language, ZOE offers a code formatting system based on a zcodeformat (yaml|json) file describing the options.
This feature is also available for IDz, but it is declared experimental for ZOE.

As far as we are concerned, COBOL formatting most of the time fail with an error message at the Language Server level.
However, this functionality interests us because we are in the phase of migrating COBOL programs whose code was generated by a product (IBM VisualAge Pacbase, or IBM Rational Programming Patterns) to a more "academic" COBOL code.

Note that in our context we do not want to reformat the entire source code but only certain portions of the code.
Our code is organized into different parts:

  1. an initial skeleton code, with the possibility of refreshing
  2. a code injected by a Coding Assistant, acting like a robot injecting snippets, but also with the possibility of refreshing this code, or removing it
  3. code manually written by the developer

It's only this third part that we want to be able to format. The other two parts must retain their formatting to ensure the possibility of refreshing or removal:

How can we diagnose formatting tool failures and thus help stabilize it?

Thanks.

@FALLAI-Denis FALLAI-Denis changed the title COBOL zcodeformat - How to help in analyze of formatting failures COBOL formatter - How to help in analyze of formatting failures Jul 9, 2024
@phaumer
Copy link
Member

phaumer commented Jul 11, 2024

@FALLAI-Denis can you check the language server logs to see if they contain related exceptions? We would like to see those to find out what causes the crash. Also any code snippets we could reproduce issues with would be helpful.

https://ibm.github.io/zopeneditor-about/Docs/locating_local_client_logs.html#locating-vs-code-extension-and-lsp-log-files-on-the-local-client

@phaumer phaumer added the bug Something isn't working label Jul 11, 2024
@FALLAI-Denis
Copy link
Author

Hi,

I didn't find any particular information in the files pointed to by "-data"...

No error message, no Java exception, but no formatting...:
_ws_1721326660661.zip

Other logs:

zopeneditor-20240718-181734.zip

exthost.zip

@FALLAI-Denis
Copy link
Author

PS: "full document format" is operational !

I found the problem: code controlled by a conditional compilation directive is not formatted, even if the condition is true.

I think code under conditional compilation control should always be formatted regardless of whether the condition is true or false.

Code out of control of conditional compilation: fully reformatted:
image

Code under control of conditional compilation: not fully reformatted, (case rules applied, but alignment rules non applied), even if condition is true
image

image

Also some "errors" in formatting...
Some of them (left before format, right after format):

image

  • level 05 and 88 and data-item in marge A

image

  • unexpected break line

image

  • unrecognized keywords

@FALLAI-Denis FALLAI-Denis changed the title COBOL formatter - How to help in analyze of formatting failures COBOL formatter - Wrongly excluding lines under conditional compilation control Jul 20, 2024
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
None yet
Development

No branches or pull requests

2 participants