MarcWeber / hasktags

Produces ctags "tags" and etags "TAGS" files for Haskell programs
Other
131 stars 33 forks source link

If a function/type is qualified, hasktags can't find it #39

Closed mrkkrp closed 6 years ago

mrkkrp commented 7 years ago

E.g. if I have Foo.Bar then it can't find Bar. Stripping Foo. part should be easy.

jhenahan commented 7 years ago

I'll be busy until the latter half of the week, but I'll add this to my list of priority items for hasktags. Thanks for the report.

mrkkrp commented 6 years ago

Fixed in haskell-mode: haskell/haskell-mode#1528.

dmwit commented 6 years ago

Closing this seems like a mistake. The problem isn't fixed, just masked by a single specific downstream tool, while other downstream tools are left hanging.

mrkkrp commented 6 years ago

I think stripping qualifiers before lookup is a responsibility of downstream tools that perform actual lookup? AFAIU hasktags just generates a TAGS file, so it already does its job well. How can it possibly strip qualifier on lookup if it doesn't perform the lookup?

jhenahan commented 6 years ago

I'm planning to try a few things to improve performance and and to rework some open PRs for this weekend, with a plan to cut a 0.70 release (see pull #44 for the main driver of the version bump) by Sunday. I'm happy to put some thought into this issue, as well, if the story for non-haskell-mode users is still bad. @dmwit Can you give an example tool that's hit by this? I use haskell-mode, myself, so I'm not sure what to test with.

dmwit commented 6 years ago

Hm, maybe I've misunderstood the original complaint. From @mrkkrp's response, it sounds like he's describing an emacs feature that looks up (say) the token under your cursor, and that feature didn't strip qualifiers before the lookup. If so, I agree that's none of hasktags' business.

The issue I'm running into is that when hasktags identifies a qualified tag, it puts the fully qualified tag name into its database. Most of the time it's not possible to put a qualified name in a binding position; the two exceptions I know about are for type and data families. So there's a type family Foo in the codebase, and searching for Foo finds the type instance Foo Bar = Baz definition but not the type instance Mod.Foo Quux = Waffle instance. (I can search for Mod.Foo explicitly and find it, but that interface is not ideal, since as imports means I can't reliably predict what the qualification will be.)