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

@source-dependency Problems #343

Closed
Giupeppe999 opened this issue Sep 18, 2024 · 20 comments
Closed

@source-dependency Problems #343

Giupeppe999 opened this issue Sep 18, 2024 · 20 comments

Comments

@Giupeppe999
Copy link

I tried to add in a source file, the comment with "@source-dependency" mark and it works correctly:
image
image

But there is a problem with the references of the variables in the working and linkage section, they don't work:

BEFORE:
image

AFTER:
image

And also if i search the references with F12, it doesn't work properly.

THIS PROBLEM IS TRIGGERED BECAUSE THE FILE THAT I REFER INTO THE SOURCE FILE CONTAINS THE SAME STRUCTURE OF THE SOURCE PLUS THE PRE-PROCESSOR DATA STRUCTURE (THAT ARE VERY IMPORTANT TO READ THE SOURCE FILE AND THEY HAVE TO BE REFERENCED IN THE SOURCE).
CAN YOU DO SOMETHING ?

According to me, we should have the possibility to choice the use of the source dependecy between:

  • only for data structure ( so the extesions scan only the working and the linkage section);
  • all of the source ( like now ).
@Giupeppe999
Copy link
Author

Can you help me for this? Tell me something... Do you understand what i mean?

@spgennard
Copy link
Owner

I'm not sure, I will need to take a look this weekend

@spgennard
Copy link
Owner

Would implementing this help?

IBM/zopeneditor-about#441

@spgennard
Copy link
Owner

spgennard commented Sep 21, 2024

I've added some code for including references from source-dep files, it is disabled by default but you enable it with setting:

scan_comments_for_references

fyi - references were never implemented for source-dep files, as the feature was more concerned with providing navigation to the definition include in the source file.

@Giupeppe999
Copy link
Author

image
It seems that it doesn't work correctly, there are references in wrong places.
And when i press F12 in a working variable, it does't find anything. And for some variable that are used in the procedure does not appear the reference tag.
image
for example in this case it matches only the declaration, but the variable is used in the procedure.
image

@Giupeppe999
Copy link
Author

Giupeppe999 commented Sep 22, 2024

ok maybe the solution is to implement the source dependency only to navigate at the declaration in the file referenced but is important to resolve the bugs above. For me could be top if i can go to the declaration in the source dependency file. but with no bugs in the references in the working. Sorry maybe i could tell that before...

@Giupeppe999
Copy link
Author

Giupeppe999 commented Sep 22, 2024

ok with the last update, the references tags seems working correctly in the code, but if i try to see the references in the procedure division with f12, from the declaration, of a variable that is used in both files (source code and source dependency activated with tag @) are always managed not correctly like in the image.

NOTE: TO REPEAT THE BUG IS IMPORTANT THAT THE SOURCE DEPENDENCY MUST BE EQUAL TO THE SOURCE FILE, BUT WITH THE ADDING OF A LOT OF STRUCTURES DECLARATIONS PUT BY PREPROCESSOR IN MY CASE.

in the image the variable S-INPU-DEPO is used in procedure division both in one file ( source) and in another (source dependency) , can you resolve this showing the using of the variable in each file as well as the declaration that appears now?
Moreover, can i choose to see in the source files only the declarations of the variables done in the source dep. and if the algoritm find more than one declaration take only the one in the source file not in the source dep.?
if can you make me possible to choose to see only declaration with mouse or f12 from source file to source dep could be the top. i want only this. please. you can make me the work easier .

image

@Giupeppe999
Copy link
Author

Giupeppe999 commented Sep 24, 2024

With last updates, everything works good, only if i press F12 on a declaration it shows only the declarations one in the source file one in the source dependency, not the using of the var, but if i press shift+f12 it works and shows me the references in the procedure and the using of var.

So the solution maybe is that if the extension is elaborating a declaration, it must not analyze the source dependency looking for another declaration, because i remind you that in my source dep there are the same declarations of the source file.
So because of this the references of a variable not used in the procedure are wrong.

NOTE
image
in the image FCBH-ISAM-MNEM for example is not used in the procedure, but it shows me 2 references because it found another declaration that is set as reference.
And for the other variables show me always the double of the references in the procedure, but this is acceptable if you cannot resolve it.

THANK YOU FOR ALL!
After this you can close the issue.

@Giupeppe999
Copy link
Author

Giupeppe999 commented Sep 24, 2024

!!!!!!!!!!!!! MAYBE ENDING SOLUTION !!!!!!!!!!!!!!!!
ANALYZINIG MY SOURCE DEPENDENCY FILE,
ONLY THE ROWS THAT HAVE IN THE FIRST 7 COLS THE STRING "adecp+" SHOULD BE ANALYZED AS SOURCE DEPENDENCY BECAUSE ARE THE PARTS THAT ARE MISSING IN THE SOURCE FILE BEFORE THE PRE-PROCCESSOR COMPILATION.
AS YOU SAID
Would implementing this help?
IBM/zopeneditor-about#441

Yes this could help, but on the opposite, so the rows with a defined string are analyzed in the source dependency, the others NOT, are ingored.

THERE IS AN EXAMPLE OF COMPILED SOURCE (IMAGE 1) THAT I WANT TO INCLUDE IN THE ORIGINAL SOURCE FILE (IMAGE 2)
image

image

@Giupeppe999
Copy link
Author

Giupeppe999 commented Sep 24, 2024

With the last commits it seems that you have implented a way to ignore party of source dependency, it'ok but i am not able to modify directly the source dependency if you find way to EXCLUDE ALL rows in the source dependency EXCEPT for the rows that start with a String is the top.
Maybe i was not clear in previous commenti.
Sorry another time 😖

@spgennard
Copy link
Owner

Please note these changes have not been released and are subject to change/ removal etc, eg if this causes stability or performance issues

Fyi. You can place a tag at the top source that turns it off

@spgennard
Copy link
Owner

Thinking about it more, the easiest way is to have a post-build step that takes your listing file and creates a dep file, for example:

       program-id. fred.
       working-storage section.
adecp+ 01 ws-wibble pic x(10).
       01 ws-second pic x.
       procedure division.

           goback.

       end program fred.

Then using the simpliest of tools:

grep -E "^adecp+" fred.cbl >fred.cbl.dep

Your get:

adecp+ 01 ws-wibble pic x(10).

@Giupeppe999
Copy link
Author

Yes, is a solution but everytime i want to modify or analyze a source file, i shoud have to do this and there are problems:

  1. the time spent to do this, because all of files are managed in this way;
  2. the files generated in the server that are a lot, for the waste of the disk space too;
  3. the source dependency can change often so it is necessary doing this process a lot of time.

Please, tell me if you can do what I said or not, you can optimize a lot our work.
Thanks and sorry for disturb.

@spgennard
Copy link
Owner

1> use a makefile or something, which if done right only does the actions unless it is out of date
2> do the dep file creation on the client
3> do it on save or a post build

extensions are available to execute commands on save, so this could be another route to ensure the dep file is always in-sync

@Giupeppe999
Copy link
Author

yes of course but i use the remote ssh extension, because we work on server so i cannot create file on the client and or on the client or on the server, there would be the same problem the amount of the genereted files, thousand of files 😖

@Giupeppe999
Copy link
Author

Any news?

@spgennard
Copy link
Owner

WIP to add regex based inclusion filter and finer grain with lsp on/off comments

With docs update

@Giupeppe999
Copy link
Author

THANK YOU, YOU'RE THE BEST

@spgennard
Copy link
Owner

You can try out, the regex is between the two /'s

*> @source-dependency /adecp+/ proc.cbl`

also you can ignore specific ranges with:

      *> BEGIN-LS-IGNORE
      01 ws-hidden pic x.
      *> END-LS-IGNOREc

If the semantic token provider is enable, then the tokens are marked as comments.

{
 "settings": {
"coboleditor.enable_semantic_token_provider": true,
..

@Giupeppe999
Copy link
Author

Thank you for all, this upagrde make us work a lot better. 😊😊

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

No branches or pull requests

2 participants