Browsing Stackage with VS Code and Glean

A follow up to the previous post about indexing Stackage with Glean, this one talks about using Glean to be able to navigate Stackage source code in VS Code.

18 Likes

Feels like a game changer! (and a bit like magic too)

I find myself browsing on hackage/hoogle just to find the source of some function there very often.

Looking forward to integration with the existing tooling

1 Like

Think about continuous integration to build the Glean DB. Perhaps this can piggyback off the stackage CI infra? If we can already build a complete stackage snapshot, and Glean is easily installable, then indexing would be fairly straightforward. I’d love to hear suggestions on how best to do this.

I think it’s a good idea, even as an experiment.

A few thoughts here on how somebody might make this happen:

Stackage automation already runs a few different tasks that process new snapshots. O(10 minutes + 1GB) isn’t a huge dent in that machinery. Someone could perhaps add a task to generate a new Glean DB and stuff it in the bucket that already holds the Hoogle DB and docs that get generated. Perhaps we would start with just doing it for new LTS major/minor snapshots, since 1GB per Nightly does add up in a way I don’t want to commit to yet.

That would get us a publicly downloadable URL for glean DBs for each LTS snapshot. Offline use is nice, but maybe not everybody wants to start off their development session by doing a 1GB download. Does glean support remote DBs in an efficient way?

The closest example of existing automation is stackage-update.service, which runs stackage-server-cron. Among other things, this creates a Hoogle DB and pushes it to a S3-compatible bucket. The parallels are obvious. (But let’s not add Glean generation to that process—I’d rather have an independent service and tool.)

Do you have already have a script for generating the Glean DB?

1 Like

This sounds plausible!

Yes, the Glean and Glass servers both expose an RPC interface using Thrift, so we could host a service. However, there’s currently no authentication or any access control at all so that’s something we would probably want to think about.

Not yet, but let me work on getting things into a state where that’s possible.

2 Likes