File tree 2 files changed +20
-2
lines changed
plugins/hls-refactor-plugin
src/Development/IDE/Plugin
2 files changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -931,9 +931,9 @@ suggestExtendImport exportsMap (L _ HsModule {hsmodImports}) Diagnostic{_range=_
931
931
| Just [binding, mod , srcspan] <-
932
932
matchRegexUnifySpaces _message
933
933
#if MIN_VERSION_ghc(9,7,0)
934
- " Add ‘([^’]*)’ to the import list in the import of ‘([^’]*)’ *\\ (at (.*)\\ )."
934
+ " Add ‘([^’]*)’ to the import list in the import of ‘([^’]*)’ *\\ (at (.*)\\ )\\ ."
935
935
#else
936
- " Perhaps you want to add ‘([^’]*)’ to the import list in the import of ‘([^’]*)’ *\\ ((.*)\\ )."
936
+ " Perhaps you want to add ‘([^’]*)’ to the import list in the import of ‘([^’]*)’ *\\ ((.*)\\ )\\ ."
937
937
#endif
938
938
= suggestions hsmodImports binding mod srcspan
939
939
| Just (binding, mod_srcspan) <-
Original file line number Diff line number Diff line change @@ -1275,6 +1275,21 @@ extendImportTests = testGroup "extend import actions"
1275
1275
, " b :: A"
1276
1276
, " b = ConstructorFoo"
1277
1277
])
1278
+ , brokenForGHC92 " On GHC 9.2, the error doesn't contain \" perhaps you want ...\" part from which import suggestion can be extracted." $
1279
+ testSession " extend single line import in presence of extra parens" $ template
1280
+ []
1281
+ (" Main.hs" , T. unlines
1282
+ [ " import Data.Monoid (First)"
1283
+ , " f = (First Nothing) <> mempty" -- parens tripped up the regex extracting import suggestions
1284
+ ])
1285
+ (Range (Position 1 6 ) (Position 1 7 ))
1286
+ [ " Add First(..) to the import list of Data.Monoid"
1287
+ , " Add First(First) to the import list of Data.Monoid"
1288
+ ]
1289
+ (T. unlines
1290
+ [ " import Data.Monoid (First (..))"
1291
+ , " f = (First Nothing) <> mempty"
1292
+ ])
1278
1293
, brokenForGHC94 " On GHC 9.4, the error messages with -fdefer-type-errors don't have necessary imported target srcspan info." $
1279
1294
testSession " extend single line qualified import with value" $ template
1280
1295
[(" ModuleA.hs" , T. unlines
@@ -3735,3 +3750,6 @@ withTempDir f = System.IO.Extra.withTempDir $ \dir ->
3735
3750
3736
3751
brokenForGHC94 :: String -> TestTree -> TestTree
3737
3752
brokenForGHC94 = knownBrokenForGhcVersions [GHC94 ]
3753
+
3754
+ brokenForGHC92 :: String -> TestTree -> TestTree
3755
+ brokenForGHC92 = knownBrokenForGhcVersions [GHC92 ]
You can’t perform that action at this time.
0 commit comments