File tree 2 files changed +11
-1
lines changed
src/Development/IDE/Plugin/CodeAction
2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -239,6 +239,8 @@ extendImportTopLevel _ _ _ = lift $ Left "Unable to extend the import list"
239
239
-- extendImportViaParent "Bar" "Cons" AST:
240
240
--
241
241
-- import A --> Error
242
+ -- import A (Bar(..)) --> Error
243
+ -- import A (Bar(Cons)) --> Error
242
244
-- import A () --> import A (Bar(Cons))
243
245
-- import A (Foo, Bar) --> import A (Foo, Bar(Cons))
244
246
-- import A (Foo, Bar()) --> import A (Foo, Bar(Cons))
@@ -247,6 +249,8 @@ extendImportViaParent df parent child (L l it@ImportDecl {..})
247
249
| Just (hide, L l' lies) <- ideclHiding = go hide l' [] lies
248
250
where
249
251
go :: Bool -> SrcSpan -> [LIE GhcPs ] -> [LIE GhcPs ] -> TransformT (Either String ) (LImportDecl GhcPs )
252
+ go _hide _l' _pre ((L _ll' (IEThingAll _ (L _ ie))) : _xs)
253
+ | parent == unIEWrappedName ie = lift . Left $ child <> " already included in " <> parent <> " imports"
250
254
go hide l' pre (lAbs@ (L ll' (IEThingAbs _ absIE@ (L _ ie))) : xs)
251
255
-- ThingAbs ie => ThingWith ie child
252
256
| parent == unIEWrappedName ie = do
Original file line number Diff line number Diff line change @@ -3669,11 +3669,17 @@ nonLocalCompletionTests =
3669
3669
" ZeroPad"
3670
3670
[" module A where" , " import Text.Printf (FormatAdjustment (ZeroPad))" , " ZeroPad" ]
3671
3671
, completionCommandTest
3672
- " parent imported"
3672
+ " parent imported abs "
3673
3673
[" module A where" , " import Text.Printf (FormatAdjustment)" , " ZeroPad" ]
3674
3674
(Position 2 4 )
3675
3675
" ZeroPad"
3676
3676
[" module A where" , " import Text.Printf (FormatAdjustment (ZeroPad))" , " ZeroPad" ]
3677
+ , completionCommandTest
3678
+ " parent imported all"
3679
+ [" module A where" , " import Text.Printf (FormatAdjustment (..))" , " ZeroPad" ]
3680
+ (Position 2 4 )
3681
+ " ZeroPad"
3682
+ [" module A where" , " import Text.Printf (FormatAdjustment (..))" , " ZeroPad" ]
3677
3683
, completionCommandTest
3678
3684
" already imported"
3679
3685
[" module A where" , " import Text.Printf (FormatAdjustment (ZeroPad))" , " ZeroPad" ]
You can’t perform that action at this time.
0 commit comments