File tree 2 files changed +16
-2
lines changed
plugins/hls-refactor-plugin
src/Development/IDE/Plugin
2 files changed +16
-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,20 @@ extendImportTests = testGroup "extend import actions"
1275
1275
, " b :: A"
1276
1276
, " b = ConstructorFoo"
1277
1277
])
1278
+ , testSession " extend single line import in presence of extra perens" $ template
1279
+ []
1280
+ (" Main.hs" , T. unlines
1281
+ [ " import Data.Monoid (First)"
1282
+ , " f = (First Nothing) <> mempty" -- parens tripped up the regex extracting import suggestions
1283
+ ])
1284
+ (Range (Position 1 6 ) (Position 1 7 ))
1285
+ [ " Add First(..) to the import list of Data.Monoid"
1286
+ , " Add First(First) to the import list of Data.Monoid"
1287
+ ]
1288
+ (T. unlines
1289
+ [ " import Data.Monoid (First (..))"
1290
+ , " f = (First Nothing) <> mempty"
1291
+ ])
1278
1292
, brokenForGHC94 " On GHC 9.4, the error messages with -fdefer-type-errors don't have necessary imported target srcspan info." $
1279
1293
testSession " extend single line qualified import with value" $ template
1280
1294
[(" ModuleA.hs" , T. unlines
You can’t perform that action at this time.
0 commit comments