wz1000 / HieDb

Generates a references DB from .hie files

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Refs queries don't work

rikvdkleij opened this issue · comments

commented

The name-refs and type-ref commands don't work. They always return an empty result.

The content of the generated database looks okay.

I have tried several times but I don't see what I'm doing wrong. Just try to get it working for a small project.

What I noticed is that the point-info doesn't contain the reference info:

➜  testproject ~/.local/bin/hiedb --database bla.db point-info Main 15 6
Span: app/Main.hs:15:6-8
Constructors: {(HsVar, HsExpr)}
Identifiers:
Symbol:v:fun:Lib:testproject-0.1.0.0-AMJ21WZpd0z2Yf4Se70ef2
fun defined at <no location info>
    IdentifierDetails Just [B, a, r, T, y, p, e,  , -, >,  , S, t, r,
                            i, n, g] {Use}
Types:
BarType -> String

Should be fixed in master now, this was a side effect of trying to integrate with ghcide.

commented

Thanks for your quick reply! I will give it a try.

commented

Yes, that fixes it for both refs command.

The point-info command above is still missing the definition info:

fun defined at <no location info>

Yes, names from another component don't have the SrcSpan attached (which is a GHC limitation), so you can't see it via point-info. Use point-defs instead, that will search through the database for the definition.

commented

Sorry for hijacking this issue but using point-defs gives this error:

➜  testproject ~/.local/bin/hiedb --database bla.db point-defs Main 15 6
hiedb: SQLite3 returned ErrorError while attempting to perform prepare "SELECT defs.*, mods.mod,mods.unit,mods.is_boot,mods.hs_src,mods.is_real,mods.time FROM defs JOIN mods USING (hieFile) WHERE occ = :occ AND (:mod IS NULL OR mods = :mod) AND (:unit IS NULL OR unit = :unit)": no such column: mods

Ah, thanks for catching this typo. Guess I should really write some tests 😰.

Fixed in 7010bfd

commented

Yes, that fixes it!

Your quick response is really appreciated!

Ah, thanks for catching this typo. Guess I should really write some tests 😰.

I know that feeling 😄