Line Numbers on Library Reference Source Code [Adv3/Adv3Lite]

Okay, so I have modified the script that @jjmcc gave me:

#!/usr/bin/env bash

TADSLIBPATH=/usr/local/share/frobtads/tads3/lib
TADSLIBADV3LITEPATH=$TADSLIBPATH/adv3Lite

SRCFILENAME=$1
LINENUM=$2

LOOKCMD=code\ --goto

if [[ -f $TADSLIBADV3LITEPATH/$SRCFILENAME ]]
then
    $LOOKCMD $TADSLIBADV3LITEPATH/$SRCFILENAME:$LINENUM
else
    if [[ -f $TADSLIBADV3LITEPATH/en_us/$SRCFILENAME ]]
    then
        $LOOKCMD $TADSLIBADV3LITEPATH/en_us/$SRCFILENAME:$LINENUM
    else
     	if [[ -f $TADSLIBPATH/extensions/$SRCFILENAME ]]
        then
     	    $LOOKCMD $TADSLIBPATH/extensions/$SRCFILENAME:$LINENUM
        else
	        echo "$SRCFILENAME not found in adv3lite/, adv3lite/en_us/ or extensions/."
        fi
    fi
fi

(Named dtl.sh for “debug tads line”)

This works in VSCode, and you can run this from your workspace in the integrate terminal, and it opens the source file in a new tab, and automatically scrolls the the line you need. For example:

./dtl.sh action.t 57

This will open action.t and go to line 57!

This way I also get the syntax highlighting from the VSCode TADS3 extension!

Posting this here, in case anyone else finds this useful!

2 Likes