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

Fix extend imports regression #769

Merged
merged 5 commits into from
Jan 2, 2021

Conversation

pepeiborra
Copy link
Collaborator

This fixes a regression on the extend imports code action w.r.t 0.5.0.

It only arises when checkProject is disabled (by default it is enabled), so I extended the test suite to cover that case too

ghcide/src/Development/IDE/Core/OfInterest.hs Show resolved Hide resolved
ghcide/src/Development/IDE/Core/OfInterest.hs Show resolved Hide resolved
@@ -628,7 +628,14 @@ suggestExtendImport exportsMap contents Diagnostic{_range=_range,..}
| Just match <- Map.lookup binding (getExportsMap exportsMap)
, [(ident, _)] <- filter (\(_,m) -> mod == m) (Set.toList match)
= Just ident
| otherwise = Nothing

-- fallback to using GHC suggestion even though it is not always correct
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't see a test for this branch added - would be good to see it reflected there.

Copy link
Collaborator Author

@pepeiborra pepeiborra Jan 2, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, I duplicated the test suite to run without checkProject, but I just checked and it doesn't cover this branch. It might be very tricky to construct a test that covers it though, so I'm inclined to leave it until a user complains

@pepeiborra pepeiborra merged commit 90966db into haskell:master Jan 2, 2021
@pepeiborra pepeiborra deleted the extendImports-fixes branch January 2, 2021 19:22
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 this pull request may close these issues.

2 participants