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

Import suggestions for local modules #851

Closed
pepeiborra opened this issue Aug 23, 2020 · 3 comments · Fixed by haskell/ghcide#739
Closed

Import suggestions for local modules #851

pepeiborra opened this issue Aug 23, 2020 · 3 comments · Fixed by haskell/ghcide#739

Comments

@pepeiborra
Copy link
Collaborator

Currently ghcide suggests missing imports for Package modules only.

I would do this by enhancing kick to update a ShakeExtras mutable state containing a mapping from names to local modules. Then this mapping can be used by the existing suggestImports code action handler to provide the suggestions. A slight downside of this approach is that removing names from the state would be difficult. Since the names are only used to provide suggestions, this is ok.

As a refinement, use only the parsed AST, not the typed one. For modules with export lists, we only need the mod summary.

As a second refinement, get around the issue with deleted names by validating the suggestions before producing them.

@pepeiborra
Copy link
Collaborator Author

I'm grabbing this.

@wz1000
Copy link
Collaborator

wz1000 commented Aug 23, 2020

Might I suggest using hiedb for this? Module exports can be stored in the database (definitions of top level names are already stored, we just need an extra boolean flag in the table to indicate whether the definition is exported).

Actually, due to the possibility of re-exports, we would need a new table in the database.

@pepeiborra
Copy link
Collaborator Author

pepeiborra commented Aug 23, 2020

I'm happy for my solution to be simplified or replacd once hiedb lands

@pepeiborra pepeiborra transferred this issue from haskell/ghcide Jan 1, 2021
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

Successfully merging a pull request may close this issue.

2 participants