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 missing parens of auto extending imports #1526

Merged
merged 2 commits into from Mar 9, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions ghcide/src/Development/IDE/Plugin/Completions/Logic.hs
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
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