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

API for interacting with source code opened in Z Open Editor #93

Open
FALLAI-Denis opened this issue Nov 7, 2020 · 2 comments
Open
Labels
enhancement New feature or request

Comments

@FALLAI-Denis
Copy link

Description of the enhancement requested

We come from an experience of more than 30 years of using a COBOL code generator, (IBM VisualAge Pacbase, whose successor is IBM Rational Programming Patterns).

As this COBOL code generator is no longer supported, we have chosen to use VS Code and the Z Open Editor extension to maintain and develop our COBOL programs.

We are in the process of defining a new "native COBOL" development framework based on COPYBOOKs to outsource and reuse certain elements (resource description, reusable processing), and snippets to assist the developer in his coding work.

Our COBOL code generator had a particular functionality: the possibility of distributing source code on several insertion points, (concept of macro-structure in IBM Visual Age Pacbase, and in IBM Rational Programming Patterns).

We would like to have the equivalent functionality with VS Code: to have a mechanism allowing to distribute code to several places in the source code being edited in a single action, even if possible to be able to modify this distributed code after the fact (which supposes having markers in the source code to find the insertion points).

We do not have enough experience to know if VS Code is natively capable of providing this code distribution service.

This functionality could perhaps be offered by Z Open Editor since it must use a representation of the syntax tree of the code being edited.

The idea would be that Z Open Editor publishes an API allowing to interact with the source code being edited from a snippet or an evolution of the snippet principle.

Example of need to distribute code to multiple locations: add a read file in a COBOL program.
This requires:

  • the declaration of a SELECT sentence in FILE-CONTROL
  • the declaration of an FD entry in FILE SECTION
  • to code a file opening routine
  • to code a file reading routine
  • to code a file closing routine
  • possibly to code the management of calculation of breaks on keys of the read file
  • possibly to code the management of the read synchronization on the keys of the read file

Each of these actions can be managed by a snippet, but the developer must intervene on each point to call the corresponding snippet.
We would like the developer to have only one action to do and all points to be dealt with at once, and possibly editable later.

@phaumer phaumer added the enhancement New feature or request label Nov 9, 2020
@FALLAI-Denis
Copy link
Author

FALLAI-Denis commented Nov 10, 2020

I think I have found an answer to the expressed need: the "macros" extension in the VS Code marketplace.
https://marketplace.visualstudio.com/items?itemName=geddski.macros
or https://marketplace.visualstudio.com/items?itemName=ctf0.macros

This extension allows you to insert pre-declared snipets by procedural code, optionally after searching the source code to find the appropriate insertion point.

But if this functionality could be integrated natively into Z Open Editor, with the intelligence of the Language Server to identify information, I think it would be even better.

@FALLAI-Denis
Copy link
Author

FALLAI-Denis commented Feb 23, 2023

Hi,

VS Code can display the Outline view on a program (COBOL), and this Outline view allows you to position yourself in the source code text of the program (COBOL).

It is still necessary that the structure of the program displayed by the Outline view be made available, and it seems to me that this is the role of the Language Server (COBOL) of Z Open Editor.

There must therefore exist native VS Code APIs, not linked to Z Open Editor, to create and manipulate the program structure information and from this structure to position itself in the source code.

Unfortunately my knowledge of VS Code APIs is very limited.

Could someone put me on the trail of these APIs?

With these APIs we could improve our code injection tooling by referencing the structure of the program rather than key lookup functions in the text of the source file (currently source code markup in line number area, columns 1 to 6), which is far from satisfactory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants