qri-io / qri

you're invited to a data party!
https://qri.io
GNU General Public License v3.0
1.1k stars 66 forks source link

feature request: detect unloaded packages from error messages #1984

Open dustmop opened 2 years ago

dustmop commented 2 years ago

If a transform run returns an error about an undefined name, and that name matches one of the known packages in starlib, suggest adding the load directive for that package. For example:

soup = bsoup.parseHtml(text)

Would return download-example.star:12:8: undefined: bsoup

Since the symbol bsoup is the root cause of this error, we could detect that the bsoup package needs to be loaded by adding load("bsoup.star", "bsoup") to the start of the file.