@@ -964,7 +964,7 @@ suggestModuleTypo Diagnostic{_range=_range,..}
964964 [modul, " (from" , _] -> Just modul
965965 _ -> Nothing
966966
967- suggestExtendImport :: ExportsMap -> ParsedSource -> Diagnostic -> [(T. Text , CodeActionKind , Rewrite )]
967+ suggestExtendImport :: ExportsMap -> ParsedSource -> Diagnostic -> [(T. Text , CodeActionKind , CodeActionPreferred , Rewrite )]
968968suggestExtendImport exportsMap (L _ HsModule {hsmodImports}) Diagnostic {_range= _range,.. }
969969 | Just [binding, mod , srcspan] <-
970970 matchRegexUnifySpaces _message
@@ -992,6 +992,7 @@ suggestExtendImport exportsMap (L _ HsModule {hsmodImports}) Diagnostic{_range=_
992992 Just ident <- lookupExportMap binding mod
993993 = [ ( " Add " <> renderImportStyle importStyle <> " to the import list of " <> mod
994994 , quickFixImportKind' " extend" importStyle
995+ , True
995996 , uncurry extendImport (unImportStyle importStyle) decl
996997 )
997998 | importStyle <- NE. toList $ importStyles ident
@@ -1434,7 +1435,7 @@ removeRedundantConstraints df (makeDeltaAst -> L _ HsModule {hsmodDecls}) Diagno
14341435
14351436-------------------------------------------------------------------------------------------------
14361437
1437- suggestNewOrExtendImportForClassMethod :: ExportsMap -> ParsedSource -> T. Text -> Diagnostic -> [(T. Text , CodeActionKind , [Either TextEdit Rewrite ])]
1438+ suggestNewOrExtendImportForClassMethod :: ExportsMap -> ParsedSource -> T. Text -> Diagnostic -> [(T. Text , CodeActionKind , CodeActionPreferred , [Either TextEdit Rewrite ])]
14381439suggestNewOrExtendImportForClassMethod packageExportsMap ps fileContents Diagnostic {_message}
14391440 | Just [methodName, className] <-
14401441 matchRegexUnifySpaces
@@ -1454,6 +1455,7 @@ suggestNewOrExtendImportForClassMethod packageExportsMap ps fileContents Diagnos
14541455 Just decl ->
14551456 [ ( " Add " <> renderImportStyle style <> " to the import list of " <> moduleText,
14561457 quickFixImportKind' " extend" style,
1458+ True ,
14571459 [Right $ uncurry extendImport (unImportStyle style) decl]
14581460 )
14591461 | style <- importStyle
@@ -1462,7 +1464,7 @@ suggestNewOrExtendImportForClassMethod packageExportsMap ps fileContents Diagnos
14621464 _
14631465 | Just (range, indent) <- newImportInsertRange ps fileContents
14641466 ->
1465- (\ (kind, unNewImport -> x) -> (x, kind, [Left $ TextEdit range (x <> " \n " <> T. replicate indent " " )])) <$>
1467+ (\ (kind, unNewImport -> x) -> (x, kind, True , [Left $ TextEdit range (x <> " \n " <> T. replicate indent " " )])) <$>
14661468 [ (quickFixImportKind' " new" style, newUnqualImport moduleText rendered False )
14671469 | style <- importStyle,
14681470 let rendered = renderImportStyle style
@@ -1471,7 +1473,7 @@ suggestNewOrExtendImportForClassMethod packageExportsMap ps fileContents Diagnos
14711473 | otherwise -> []
14721474 where moduleText = moduleNameText identInfo
14731475
1474- suggestNewImport :: DynFlags -> ExportsMap -> ParsedSource -> T. Text -> Diagnostic -> [(T. Text , CodeActionKind , TextEdit )]
1476+ suggestNewImport :: DynFlags -> ExportsMap -> ParsedSource -> T. Text -> Diagnostic -> [(T. Text , CodeActionKind , CodeActionPreferred , TextEdit )]
14751477suggestNewImport df packageExportsMap ps fileContents Diagnostic {.. }
14761478 | msg <- unifySpaces _message
14771479 , Just thingMissing <- extractNotInScopeName msg
@@ -1491,7 +1493,7 @@ suggestNewImport df packageExportsMap ps fileContents Diagnostic{..}
14911493 = let qis = qualifiedImportStyle df
14921494 suggestions = nubSortBy simpleCompareImportSuggestion
14931495 (constructNewImportSuggestions packageExportsMap (qual <|> qual', thingMissing) extendImportSuggestions qis) in
1494- map (\ (ImportSuggestion _ kind (unNewImport -> imp)) -> (imp, kind, TextEdit range (imp <> " \n " <> T. replicate indent " " ))) suggestions
1496+ map (\ (ImportSuggestion _ kind (unNewImport -> imp)) -> (imp, kind, True , TextEdit range (imp <> " \n " <> T. replicate indent " " ))) suggestions
14951497 where
14961498 L _ HsModule {.. } = ps
14971499suggestNewImport _ _ _ _ _ = []
0 commit comments