hasktags icon indicating copy to clipboard operation
hasktags copied to clipboard

qualified tags should have their qualification stripped before storing them

Open dmwit opened this issue 6 years ago • 3 comments

Currently when hasktags encounters tags with qualified names, it puts the entire qualified name in the ctags file. For example, with the following Haskell code:

type instance A B = C
type instance MC.A B = C

I get the following ctags file:

A	test.hs	1
MC.A	test.hs	2
instance	test.hs	1
instance	test.hs	2

Leaving aside the spurious tags for instance for the moment, I think the second line should have A instead of MC.A.

In case it matters (or makes things simpler somehow), I believe that type and data families are currently the only place where bindings can be qualified.

(This is a follow-on to my comments on issue #39. I initially commented there due to a misunderstanding; this is a separate issue, and that one should stay closed.)

dmwit avatar May 15 '18 19:05 dmwit

Thanks for the new report! I’ll be looking into it this weekend, I hope.

jhenahan avatar May 15 '18 21:05 jhenahan

Will this affect if you have qualified imports ala elm? Like:

Import qualified Mod1 as A
import qualified Mod2 as B

And they both have:

A.get
B.get

Wouldn't retaining the qualified names be better?

codygman avatar Oct 02 '19 18:10 codygman

Retaining qualified names is not better, because the qualification is only local: when viewing another module, if I see the name get, I cannot know just from that whether I should be jumping to the tag for get, A.get, or B.get. If there are three definitions of get with different qualifications, the tags file should list all three.

Of course, for a name like get this won't happen, because you currently cannot put qualified value-level names in binding position, as I mentioned in the original bug report. But the point stands anyway: local qualifications should be dropped when creating the tags file, so that there is a predictable tag to request when looking at things outside that local scope.

dmwit avatar Oct 02 '19 19:10 dmwit