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

Support crossreference for imported modules and entities #6

Closed
robinp opened this issue May 31, 2017 · 4 comments · Fixed by #97 or #102
Closed

Support crossreference for imported modules and entities #6

robinp opened this issue May 31, 2017 · 4 comments · Fixed by #97 or #102

Comments

@robinp
Copy link
Collaborator

robinp commented May 31, 2017

As final result, the named entries in the import list should be properly hyperlinked.

The module names, like Foo in import Foo (bar, baz), should ref/imports the module node (see #8 ). Also, bar and baz should ref/imports too.

Dotted imports

import Foo (Bar(..)) - should we emit multiple ref/imports edges from the ..s? Or just do nothing there.

Aliased imports

What about aliased imports (regardless of qualification)? For example:

import Data.Text as T
...
foo = T.append "x" "y"

Easiest is we do nothing. In any case, T.append will still refer to the same node. If we emitted a defines/binding on T of the import line, then the T of T.append might ref that. But there's no really suitable node in the kythe schema (unless we shoehorn talias + aliases), and the benefit is dubious. Also, the def/binding would need to come from an implicit anchor, since multiple modules can be aliased to the same name (so the T in the import line would also be a reference).

@robinp robinp modified the milestone: 2017-summer Jun 9, 2017
@robinp
Copy link
Collaborator Author

robinp commented Jun 10, 2017

Info: GHC AST stores these as ImportDecl available from the RenamedSource.

Also, the implicit prelude import happens from a funny location. If the import is implicit, we shouldn't attach a Span to it in the translate layer rather (and then the reference will have an implicit anchor in Kythe).

@robinp
Copy link
Collaborator Author

robinp commented Aug 29, 2017

Module names are referenced now, thanks to Ivan.

To be done: to keep it simple, ref/imports the explicitly mentioned imported names, maybe ref/imports/hiding those in a hiding clause.

@robinp
Copy link
Collaborator Author

robinp commented Aug 31, 2017

Actually, both the module name and the import statements seem to ref the module entry, but noone is defines/binding it. So Kythe navigation to definition doesn't work.

@robinp
Copy link
Collaborator Author

robinp commented Aug 31, 2017

Actually now the module name just refs the node, but doesn't emit a defines/binding, so Kythe navigation to definition doesn't work on imports.

jinwoo added a commit to jinwoo/haskell-indexer that referenced this issue Sep 25, 2019
jinwoo added a commit that referenced this issue Sep 26, 2019
* Support xrefs for imported entities.

This fixes #6.

* fix older GHC versions

* delete unused imports

* fix for ghc 8.0.x

* address review comments

* flag for generating xrefs for hidden imports

* verification tests.

Also fix existing errors.
@jinwoo jinwoo reopened this Sep 26, 2019
jinwoo added a commit to jinwoo/haskell-indexer that referenced this issue Sep 26, 2019
jinwoo added a commit to jinwoo/haskell-indexer that referenced this issue Sep 28, 2019
jinwoo added a commit that referenced this issue Sep 28, 2019
* Support xrefs for type/data constructors and data fields.

Fixes #6.

* catMaybes . map --> mapMaybe
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants