Code navigation in basic project and rba extensions

Here you can discuss the universal Integrated Development Environment for OpenVMS.

Topic author
alister
Contributor
Posts: 16
Joined: Fri Sep 29, 2023 3:00 am
Reputation: 0
Status: Offline

Code navigation in basic project and rba extensions

Post by alister » Wed Nov 22, 2023 9:06 pm

I am trying to get code navigation going. Our code base primarily use VMS Basic. Presently it fails to find the defintion of most symbols or their references.

It's split between .rba and .bas files - where rba files are basic files that are preprocessed by RDBPRE

I've set the rba files as VMS-BASIC files - they are syntax highlighted accordingly.

As a starting point, while i investigate this more, do i have to do anything else to have to have vs code parse my basic files for symbols definition and references ? e.g
https://code.visualstudio.com/docs/lang ... a-language

Does the terminology "reparse a basic project" indicate i have to do anything to set it as a basic project ? Current project type is just "executable"

I've started to look through the code https://github.com/vmssoftware/vms-ide/ ... on.ts#L121, and https://github.com/vmssoftware/vms-ide/ ... ation.json but i haven't looked at vs code's language server functionality before so i thought i would post an initial check here as to whether rba files should be being parsed.

On enacting the "Reparse basic project" command, I dont' see a list of files being parsed output in the Developer Tools. I see "Found workspace for scope ..... " and other logging but nothing else obviously of interest

A lot of our references are link time via EXTERN keywords - but it doesn't presently seem to pick up either included functions, or link time resolved functions.
Last edited by alister on Wed Nov 22, 2023 9:09 pm, edited 1 time in total.


sergey_vorfolomeev
VSI Expert
Master
Posts: 101
Joined: Thu Aug 22, 2019 12:17 am
Reputation: 0
Status: Offline

Re: Code navigation in basic project and rba extensions

Post by sergey_vorfolomeev » Thu Nov 23, 2023 5:11 am

I have a look to the code - unfortunately only .bas files are parsed.

User avatar

arne_v
Master
Posts: 347
Joined: Fri Apr 17, 2020 7:31 pm
Reputation: 0
Location: Rhode Island, USA
Status: Offline
Contact:

Re: Code navigation in basic project and rba extensions

Post by arne_v » Thu Nov 23, 2023 10:18 am

I know nothing about VMS IDE and VS Code in general.

But shouldn't there be a way to associate file extensions with language?

Only one file extension per language does not work. C got .c and .h. C++ got lots (.cpp, .cc, .cxx, .h, .hpp, .hxx).

So associating both .bas and .rba with Basic seems quite natural to me.

I am more curious about the context. I did not know that Rdb pre-compiler supported Basic. And why is it .rba and not .sba?
Arne
arne@vajhoej.dk
VMS user since 1986


sodjan
Active Contributor
Posts: 40
Joined: Mon Apr 24, 2023 3:51 am
Reputation: 0
Status: Offline

Re: Code navigation in basic project and rba extensions

Post by sodjan » Thu Nov 23, 2023 6:11 pm

This is a little weird...

One (maybe a little old) manual says: "The SQL Precompiler does not support BASIC".

Other sources lists Ada, C, COBOL, FORTRAN, Pascal, and PL/I as the supported languages by the SQL precompiler.
And also lists the following default filetypes:

Ada .sqlada
C .sc
COBOL .sco
FORTRAN .sfo
Pascal .spa
PL/I .spl

Does those .rba files mentioned here have the usual "exec sql" and "end_exec" sections?

But with that said, all the other "sql" variants of the file types mentioned above, are Oracle (Rdb) specific.
So maybe it is not that surprising that they are not included/supported in a development tool from VSI (?).

Edit:
Thinking a little bit more about this...
RDBPRE is the old way of integrating Rdb in source code that uses RDO-like syntax. *Not* SQL.
The SQL pre-compiler is called SQLPRE (or SQL$PRE).

Found an RDO/RDBPRE/RDML manual and it lists these default filetypes for the supported languages:

BASIC .RBA
COBOL .RCO
FORTRAN .RFO

The manual has a few example like:

Code: Select all

! Fetch a CANDIDATES record.
&RDB& FETCH cands
&RDB&    AT END
       end_of_cands = -1%
&RDB& END_FETCH
       IF NOT end_of_cands
       THEN
&RDB&     GET
&RDB&        candidates::last_name = CA.LAST_NAME;
&RDB&        candidates::first_name = CA.FIRST_NAME;
&RDB&        candidates::candidate_status::string_value
&RDB&              = CA.CANDIDATE_STATUS
&RDB&     END_GET
       END IF
RETURN
That is not at all like the way SQL is included when using the SQL precompiler...
Last edited by sodjan on Thu Nov 23, 2023 6:48 pm, edited 2 times in total.

User avatar

arne_v
Master
Posts: 347
Joined: Fri Apr 17, 2020 7:31 pm
Reputation: 0
Location: Rhode Island, USA
Status: Offline
Contact:

Re: Code navigation in basic project and rba extensions

Post by arne_v » Thu Nov 23, 2023 6:40 pm

There is nothing surprising that VMS IDE out of the box does not know what an .rba file is.

It would be nice if when user attempts to open it asked the user to pick a language for that file extension.
Arne
arne@vajhoej.dk
VMS user since 1986


Topic author
alister
Contributor
Posts: 16
Joined: Fri Sep 29, 2023 3:00 am
Reputation: 0
Status: Offline

Re: Code navigation in basic project and rba extensions

Post by alister » Thu Nov 23, 2023 9:34 pm

I find the terminology confusing when talking about the RDB Pre-processor - i suspect there is more than one. The kind of code we have is marked by &RDB& and pre-processed by RDBPRE. The best doco i've found is in the "VAX Rdb/VMS
Guide to Using RDO, RDBPRE, and RDML", a copy of which is here

https://sector7.com/s7/Reference/VMS_Ma ... Manual.pdf
See "Using the &RDB& Statement Flag" and the subsequent chapter on using it in BASIC

I don't believe these lines withe "&RDB" need to be parsed by the language server. I'm pretty ignorant of BASIC, but given the explicit END_FUNCTION style tokens, i don't *think* they will introduce and tokens that would confuse the language parser (famous last words !!, and looking at https://github.com/vmssoftware/vms-ide/ ... guage.json)

So, given that in the IDE i can change the file extension to language association, i wondered if that can be passed through to the language extension - so that it parses "BASIC" files - not just (.BAS files). Having a quick scout around it appears there are a couple of areas that might relate - firstly the activation events
https://github.com/vmssoftware/vms-ide/ ... e.json#L56 seem to be ok, related to just basic, but this line
https://github.com/vmssoftware/vms-ide/ ... .json#L182 has only the one extension

Checking https://code.visualstudio.com/api/refer ... .languages it really does look like it gets hard coded extensions.

So, i guess this comes down to Sergey - in the next release could this please have .rba added to it, and maybe any other extensions that .RCO, .RBA, .RFO ? (We don't use the others, just they are in the doco)

User avatar

arne_v
Master
Posts: 347
Joined: Fri Apr 17, 2020 7:31 pm
Reputation: 0
Location: Rhode Island, USA
Status: Offline
Contact:

Re: Code navigation in basic project and rba extensions

Post by arne_v » Thu Nov 23, 2023 11:09 pm

Mystery is solved. You are not using SQL but RDO.

I did not think about that. I have not used RDO since the late 1980's.

There is Basic support and the extension is .rba.

Rather logical. R for RDO instead of S for SQL.
Arne
arne@vajhoej.dk
VMS user since 1986


Topic author
alister
Contributor
Posts: 16
Joined: Fri Sep 29, 2023 3:00 am
Reputation: 0
Status: Offline

Re: Code navigation in basic project and rba extensions

Post by alister » Fri Nov 24, 2023 1:04 am

Thanks Arne. Knowing the correct terminology for RDO will help with some other research i'm doing - appreciated


sodjan
Active Contributor
Posts: 40
Joined: Mon Apr 24, 2023 3:51 am
Reputation: 0
Status: Offline

Re: Code navigation in basic project and rba extensions

Post by sodjan » Fri Nov 24, 2023 4:38 am

What if you, just as a simple test, change the file type from RBA to BAS on one file. Does it then display as expected in the IDE?

Note that RBA is probably just the default file type for Basic files processed by RDBPRE, you can pass any filename/type on the RDBPRE command line, including BAS. Might not be that practical, of course.

Now, I have never used RDO or RDBPRE. When I started with Rdb 25-30 years ago, SQL was already in the standard Rdb kit.

Also, when I saw an Oracle presentation on the ongoing x86 port of Rdb, I *think* I saw RDO and RDBPRE mentioned. But, if it had been my code base, I would probably wanted to double-check that.

So, how does this work today for applications in Basic where you want to use SQL? You can always use SQLMOD to compile your SQL code and then just link those object files to your Basic apps.
Last edited by sodjan on Fri Nov 24, 2023 4:43 am, edited 1 time in total.

User avatar

imiller
Master
Posts: 147
Joined: Fri Jun 28, 2019 8:45 am
Reputation: 0
Location: South Tyneside, UK
Status: Offline
Contact:

Re: Code navigation in basic project and rba extensions

Post by imiller » Fri Nov 24, 2023 11:05 am

I've not seen RDO, RDML etc for decades since RDB 3.0(?) which introduced SQLMOD etc.
Ian Miller
[ personal opinion only. usual disclaimers apply. Do not taunt happy fun ball ].

Post Reply