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

Do not suggest explicit import lists for qualified imports #354

Merged
merged 1 commit into from
Aug 27, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/Ide/Plugin/ImportLens.hs
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,16 @@ extractMinimalImports (Just (hsc)) (Just (tmrModule -> TypecheckedModule{..})) =

extractMinimalImports _ _ = return ([], Nothing)

-- | Given an import declaration, generate a code lens unless it has an explicit import list
-- | Given an import declaration, generate a code lens unless it has an
-- explicit import list or it's qualified
generateLens :: PluginId -> Uri -> Map SrcLoc (ImportDecl GhcRn) -> LImportDecl GhcRn -> IO (Maybe CodeLens)
generateLens pId uri minImports (L src imp)
-- Explicit import list case
| ImportDecl{ideclHiding = Just (False,_)} <- imp
= return Nothing
-- Qualified case
| ImportDecl{ideclQualified = True} <- imp
= return Nothing
-- No explicit import list
| RealSrcSpan l <- src
, Just explicit <- Map.lookup (srcSpanStart src) minImports
Expand Down