codefori / vscode-rpgle

RPGLE language tools for VS Code
MIT License
39 stars 20 forks source link

Linter marks program main procedure as unreferenced if ctl-opt is in copybook #322

Open EVLSDE opened 1 month ago

EVLSDE commented 1 month ago

Describe the bug If you use a copybook for your control statements and include the main() statement, a program using this copybook will have its correctly defined main procedure marked as "No reference to definition.".

To Reproduce Let's say you want to use a standard name for the main procedure of your programs, e.g. "Main". You define a copybook (e.g. "qcpylesrc/cpypgm_h.rpgle", which includes the following statement: ctl-opt main(Main);

You include the copybook in your program source and define the main procedure:

/copy 'qcpylesrc/cpypgm_h.rpgle'

dcl-proc Main;

Then the main procedure will be marked as "no reference to definition" by the linter. If you replace the /copy in the program source with its contents, the same warning disappears.

Expected behavior The linter should not be marking the procedure as "No reference to definition.", because the ctl-opt statement clearly takes use of it.

Screenshots See example code given above

Environment:

Additional context None.

worksofliam commented 1 month ago

I've been thinking about this and I'd consider this valid since the linter expects it to be in the main source and not a copybook. We likely need something else to allow this.

edit: thanks for your great bug reports btw!