Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add pseudo-xrefs for implicitly imported entities #100

Open
jinwoo opened this issue Sep 25, 2019 · 3 comments
Open

Add pseudo-xrefs for implicitly imported entities #100

jinwoo opened this issue Sep 25, 2019 · 3 comments

Comments

@jinwoo
Copy link
Member

jinwoo commented Sep 25, 2019

Related to #6 and #97.

#97 adds xrefs for explicit imports but not for implicit ones.

@robinp
Copy link
Collaborator

robinp commented Sep 25, 2019

Re "no trivial span to put these":

That's true, but one could pack an existing span (say the module name span), given a good UI that can handle that.

Re "how is this useful":

One usecase I can think of is showing "imported via" info on the UI. Sometimes, if there are many implicit imports, it is not clear which one imports a given name. If the ref/imports is available on the file, the UI could reconstruct that info.

OTOH if the exported name list is long (maybe auto-generated stuff from protos), this would be quite a burden, and need limiting...

I would say if someone cares (maybe CodeUnderhood one day), they should implement this.

@robinp
Copy link
Collaborator

robinp commented Oct 6, 2019

Re the "imported via" feature: I think that is solvable even without having the implicit import refs. One could query the reverse-childof edges of the imported module, and intersect with the refs in the current module. That would automatically yield the actually used imports from a given module.

@robinp
Copy link
Collaborator

robinp commented Oct 7, 2019

Inspired by TreeTide/underhood#10, I believe we should consider

Why do I think this is a better alternative than letting the frontend calculate the imported-via info itself?

  • It is more explicit - less logic left for the frontend.

  • It is more in line with other indexers - it is expected that Typescript, Python etc indexers would have similar behavior.

  • If the frontend wanted to implicitly guess imported-via (based on matching an imported module name with the module name of a used name), it would run into trouble with reexports: if module M reexports foo from module X, but we only import M and use foo, the implicit guess won't work (there's no module X, which is the module of foo, directly imported).

Implementation Note: this can be implemented purely in the kythe-frontend, shouldn't affect GHC traversal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants