sourcegraph / scip

SCIP Code Intelligence Protocol
Apache License 2.0
231 stars 32 forks source link

SCIP sqlite database? #233

Open michaelpj opened 3 months ago

michaelpj commented 3 months ago

I was taking a look at this project, it seems very cool. In particular, I think we could potentially use it as an intermediary format between the information files that the Haskell compiler GHC produces (HIE files) and the Haskell Language Server.

One thing we do at the moment with HIE files is that we index them and put them into a sqlite database (https://github.com/wz1000/HieDb). That way we can query things like references conveniently without having to maintain specialised data structures for our specific querying patterns.

Since SCIP is generic, I wonder if there could be a space for a generic SCIP sqlite schema and ingestor? Or is it just that everyone has sufficiently different application-specific needs that there is no point?

varungandhi-src commented 2 months ago

I've had the same idea but primarily for the debugging use case (not as API) -- it'd be nice to be able to quickly convert a SCIP index to a SQL database to perform ad-hoc queries to check well-formedness, counts etc. Currently, you can do some scripting using the scip print --json functionality and then using JQ on top of that.

Right now, the scip lint subcommand does a bunch of custom tracking and traversals - it would be nice to specify those as SQL queries instead.

If we're making this a stable thing, it would require some care around maintaining backwards compatibility as we add new things (or explicitly stating that there aren't any compatibility guarantees, which would be frustrating through from a tooling POV).