Skip to content

Commit ba5c168

Browse files
committed
Fix last test
1 parent 6f60029 commit ba5c168

File tree

3 files changed

+7
-0
lines changed

3 files changed

+7
-0
lines changed

plugins/hls-refactor-plugin/hls-refactor-plugin.cabal

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,8 @@ test-suite tests
110110
, hls-test-utils == 2.6.0.0
111111
, lens
112112
, lsp-types
113+
-- for MIN_VERSION_ghc
114+
, ghc
113115
, text
114116
, hls-plugin-api
115117
, parser-combinators

plugins/hls-refactor-plugin/src/Development/IDE/Plugin/CodeAction.hs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1453,7 +1453,11 @@ suggestNewImport df packageExportsMap ps fileContents Diagnostic{..}
14531453
*> extractQualifiedModuleNameFromMissingName (extractTextInRange _range fileContents)
14541454
, Just (range, indent) <- newImportInsertRange ps fileContents
14551455
, extendImportSuggestions <- matchRegexUnifySpaces msg
1456+
#if MIN_VERSION_ghc(9,7,0)
1457+
"Add ‘[^’]*’ to the import list in the import of ‘([^’]*)’"
1458+
#else
14561459
"Perhaps you want to add ‘[^’]*’ to the import list in the import of ‘([^’]*)’"
1460+
#endif
14571461
= let qis = qualifiedImportStyle df
14581462
-- FIXME: we can use thingMissing once the support for GHC 9.4 is dropped.
14591463
-- In what fllows, @missing@ is assumed to be qualified name.

plugins/hls-refactor-plugin/test/Main.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1673,6 +1673,7 @@ suggestImportTests :: TestTree
16731673
suggestImportTests = testGroup "suggest import actions"
16741674
[ testGroup "Dont want suggestion"
16751675
[ -- extend import
1676+
-- We don't want to suggest a new import, but extend existing imports
16761677
test False ["Data.List.NonEmpty ()"] "f = nonEmpty" [] "import Data.List.NonEmpty (nonEmpty)"
16771678
-- data constructor
16781679
, test False [] "f = First" [] "import Data.Monoid (First)"

0 commit comments

Comments
 (0)