OCamlPro / superbol-studio-oss

Open-Source part of SuperBOL Studio, including the Visual Studio Code extension and its LSP server
https://superbol.eu
Other
24 stars 13 forks source link

bind variables should be recognized (goto/show definition) #327

Open GitMensch opened 3 months ago

GitMensch commented 3 months ago

bind variables (= variables that are from the COBOL part) are always prefixed with a double-colon:

EXEC SQL
    DELETE FROM TAB WHERE TABID = :VAR
END-EXEC

VAR should be referenced as COBOL variable and therefore goto/show definition should apply to it.

GitMensch commented 3 months ago

Is that hard enough to postpone to ß - or is the later "in sight" already?

nberth commented 3 months ago

Let's say a "dumb" preliminary implementation could be done quickly, especially for bound variables that appear somewhere in the PROCEDURE DIVISION. For EXECs that appear in the DATA DIVISION things may be more intricate; but may these EXECs feature bound variables?

GitMensch commented 3 months ago

The bin variables are normally only in WORKING STORAGE or LINKAGE within EXEC SQL DECLARE or in copybooks included by EXEC SQL INCLUDE - and always "defined above" (no forward declarations).

So yes, in general the lookup seems "dumb" (and minimal more complex for the EXEC SQL INCLUDE copybookname case, but that's either understood by the LSP already or not [in this case it would be good to add it in general - that's just a COPY without REPLACE option done by the sql preprocessor before the compiler sees it]).