Skip to content

Commit

Permalink
Fix missing parens of auto extending imports (#1526)
Browse files Browse the repository at this point in the history
Co-authored-by: Javier Neira <[email protected]>
  • Loading branch information
berberman and jneira authored Mar 9, 2021
1 parent 94573be commit e16833e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
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

0 comments on commit e16833e

Please sign in to comment.