From 455499af3404db9bde68a31aec3eadba3d6be2e4 Mon Sep 17 00:00:00 2001 From: Potato Hatsue <1793913507@qq.com> Date: Tue, 9 Mar 2021 11:23:32 +0800 Subject: [PATCH] Fix missing parens of auto extending imports --- ghcide/src/Development/IDE/Plugin/Completions/Logic.hs | 6 +++--- ghcide/test/exe/Main.hs | 6 ++++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/ghcide/src/Development/IDE/Plugin/Completions/Logic.hs b/ghcide/src/Development/IDE/Plugin/Completions/Logic.hs index 72419eb64a..c58dfbe8ae 100644 --- a/ghcide/src/Development/IDE/Plugin/Completions/Logic.hs +++ b/ghcide/src/Development/IDE/Plugin/Completions/Logic.hs @@ -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 @@ -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' diff --git a/ghcide/test/exe/Main.hs b/ghcide/test/exe/Main.hs index 852bcd992d..4e3d71cc27 100644 --- a/ghcide/test/exe/Main.hs +++ b/ghcide/test/exe/Main.hs @@ -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