From 6c4c040cbb3ef9c8c334ab30742462715ae0d4de Mon Sep 17 00:00:00 2001 From: mrkun Date: Sun, 16 Jan 2022 18:40:32 +0300 Subject: [PATCH 1/2] [ghc-9.2] Fix qualify-imported-names plugin --- .github/workflows/test.yml | 2 +- cabal-ghc921.project | 1 - plugins/hls-qualify-imported-names-plugin/README.md | 4 +++- .../hls-qualify-imported-names-plugin.cabal | 2 +- .../src/Ide/Plugin/QualifyImportedNames.hs | 5 ++--- stack-9.2.1.yaml | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c2e821e198..3a61cef4ca 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -226,7 +226,7 @@ jobs: name: Test hls-alternate-number-format-plugin test suite run: cabal test hls-alternate-number-format-plugin --test-options="$TEST_OPTS" || cabal test hls-alternate-number-format-plugin --test-options="$TEST_OPTS" || LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true cabal test hls-alternate-number-format-plugin --test-options="$TEST_OPTS" - - if: matrix.test && matrix.ghc != '9.2.1' + - if: matrix.test name: Test hls-qualify-imported-names-plugin test suite run: cabal test hls-qualify-imported-names-plugin --test-options="$TEST_OPTS" || cabal test hls-qualify-imported-names-plugin --test-options="$TEST_OPTS" || LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true cabal test hls-qualify-imported-names-plugin --test-options="$TEST_OPTS" diff --git a/cabal-ghc921.project b/cabal-ghc921.project index e37c195fba..66a6447024 100644 --- a/cabal-ghc921.project +++ b/cabal-ghc921.project @@ -59,7 +59,6 @@ constraints: -eval -haddockComments -hlint - -qualifyImportedNames -refineImports -retrie -splice diff --git a/plugins/hls-qualify-imported-names-plugin/README.md b/plugins/hls-qualify-imported-names-plugin/README.md index f7a20fa216..0313231af9 100644 --- a/plugins/hls-qualify-imported-names-plugin/README.md +++ b/plugins/hls-qualify-imported-names-plugin/README.md @@ -13,7 +13,9 @@ - Names are qualified by the imported module's alias if it has one, otherwise by the imported module's name. - If the import declaration has an explicit import list then the plugin will qualify only names on the list. - If the import declaration has an explicit hiding list then the plugin will qualify names from the imported module that are not on the list. - + ## Change log +### 1.0.0.1 +- GHC 9.2.1 compatibility ### 1.0.0.0 - Released... diff --git a/plugins/hls-qualify-imported-names-plugin/hls-qualify-imported-names-plugin.cabal b/plugins/hls-qualify-imported-names-plugin/hls-qualify-imported-names-plugin.cabal index 3d5e9a7a5b..bc19700cc9 100644 --- a/plugins/hls-qualify-imported-names-plugin/hls-qualify-imported-names-plugin.cabal +++ b/plugins/hls-qualify-imported-names-plugin/hls-qualify-imported-names-plugin.cabal @@ -1,6 +1,6 @@ cabal-version: 2.2 name: hls-qualify-imported-names-plugin -version: 1.0.0.0 +version: 1.0.0.1 synopsis: A Haskell Language Server plugin that qualifies imported names description: Please see the README on GitHub at diff --git a/plugins/hls-qualify-imported-names-plugin/src/Ide/Plugin/QualifyImportedNames.hs b/plugins/hls-qualify-imported-names-plugin/src/Ide/Plugin/QualifyImportedNames.hs index fd2fe979c7..6d78cee625 100644 --- a/plugins/hls-qualify-imported-names-plugin/src/Ide/Plugin/QualifyImportedNames.hs +++ b/plugins/hls-qualify-imported-names-plugin/src/Ide/Plugin/QualifyImportedNames.hs @@ -42,7 +42,7 @@ import Development.IDE.GHC.Compat (ContextInfo (Use), SrcSpan, TcGblEnv (tcg_rdr_env), emptyUFM, globalRdrEnvElts, - gre_imp, gre_name, + gre_imp, gre_name, locA, lookupNameEnv, moduleNameString, nameOccName, occNameString, @@ -96,8 +96,7 @@ findLImportDeclAt range parsedModule | ParsedModule {..} <- parsedModule , L _ hsModule <- pm_parsed_source , locatedImportDecls <- hsmodImports hsModule = - find (\ (L srcSpan _) -> isRangeWithinSrcSpan range srcSpan) locatedImportDecls - | otherwise = Nothing + find (\ (L (locA -> srcSpan) _) -> isRangeWithinSrcSpan range srcSpan) locatedImportDecls makeCodeActions :: Uri -> [TextEdit] -> [a |? CodeAction] makeCodeActions uri textEdits = [InR CodeAction {..} | not (null textEdits)] diff --git a/stack-9.2.1.yaml b/stack-9.2.1.yaml index 2ed26369d5..bec3d47ffe 100644 --- a/stack-9.2.1.yaml +++ b/stack-9.2.1.yaml @@ -102,7 +102,7 @@ flags: importLens: false moduleName: true ormolu: false - qualifyImportedNames: false + qualifyImportedNames: true refineImports: false retrie: false splice: false From 167973b3ebf8023e0e96c5ecab5a219f6334a82b Mon Sep 17 00:00:00 2001 From: mrkun Date: Mon, 17 Jan 2022 21:02:03 +0300 Subject: [PATCH 2/2] Drop default-true plugin flags from stack-9.2.1.yaml --- stack-9.2.1.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/stack-9.2.1.yaml b/stack-9.2.1.yaml index bec3d47ffe..847b56bffb 100644 --- a/stack-9.2.1.yaml +++ b/stack-9.2.1.yaml @@ -100,9 +100,7 @@ flags: haddockComments: false hlint: false importLens: false - moduleName: true ormolu: false - qualifyImportedNames: true refineImports: false retrie: false splice: false