Skip to content

Fix missing parens of auto extending imports #1526

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

Merged
merged 2 commits into from
Mar 9, 2021
Merged
Show file tree
Hide file tree
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: 3 additions & 3 deletions ghcide/src/Development/IDE/Plugin/Completions/Logic.hs
Original file line number Diff line number Diff line change
Expand Up @@ -349,8 +349,8 @@ cacheDataProducer uri env curMod globalEnv inScopeEnv limports = do
docs <- getDocumentationTryGhc packageState curMod n
let (mbParent, originName) = case par of
NoParent -> (Nothing, nameOccName n)
ParentIs n' -> (Just $ showNameWithoutUniques n', nameOccName n)
FldParent n' lbl -> (Just $ showNameWithoutUniques n', maybe (nameOccName n) mkVarOccFS lbl)
ParentIs n' -> (Just . T.pack $ printName n', nameOccName n)
FldParent n' lbl -> (Just . T.pack $ printName n', maybe (nameOccName n) mkVarOccFS lbl)
tys <- catchSrcErrors (hsc_dflags packageState) "completion" $ do
name' <- lookupName packageState m n
return ( name' >>= safeTyThingType
Expand All @@ -360,7 +360,7 @@ cacheDataProducer uri env curMod globalEnv inScopeEnv limports = do

let recordCompls = case record_ty of
Just (ctxStr, flds) | not (null flds) ->
[mkRecordSnippetCompItem uri mbParent ctxStr flds (ppr mn) docs imp']
[mkRecordSnippetCompItem uri mbParent ctxStr flds (ppr mn) docs imp']
_ -> []

return $ mkNameCompItem uri mbParent originName mn ty Nothing docs imp'
Expand Down
6 changes: 6 additions & 0 deletions ghcide/test/exe/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -3993,6 +3993,12 @@ nonLocalCompletionTests =
["module A where", "import Data.Maybe ()", "Nothing"]
(Position 2 4)
"Nothing"
, completionCommandTest
"type operator parent"
["module A where", "import Data.Type.Equality ()", "f = Ref"]
(Position 2 8)
"Refl"
["module A where", "import Data.Type.Equality ((:~:) (Refl))", "f = Ref"]
]
, testGroup "Record completion"
[ completionCommandTest
Expand Down