Skip to content

Commit b01a94a

Browse files
mxxunjneira
andauthored
Fix module-name plugin on ghc-9.2.1 (#2594)
* Fix module-name plugin on ghc-9.2.1 * Removing flag Also enables the plugin Co-authored-by: Javier Neira <atreyu.bbb@gmail.com>
1 parent 87fb2e0 commit b01a94a

File tree

6 files changed

+7
-7
lines changed

6 files changed

+7
-7
lines changed

.github/workflows/test.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ jobs:
210210
name: Test hls-hlint-plugin test suite
211211
run: cabal test hls-hlint-plugin --test-options="$TEST_OPTS" || cabal test hls-hlint-plugin --test-options="$TEST_OPTS" || LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true cabal test hls-hlint-plugin --test-options="$TEST_OPTS"
212212

213-
- if: matrix.test && matrix.ghc != '9.2.1'
213+
- if: matrix.test
214214
name: Test hls-module-name-plugin test suite
215215
run: cabal test hls-module-name-plugin --test-options="$TEST_OPTS" || cabal test hls-module-name-plugin --test-options="$TEST_OPTS" || LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true cabal test hls-module-name-plugin --test-options="$TEST_OPTS"
216216

cabal-ghc921.project

-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ constraints:
5959
-eval
6060
-haddockComments
6161
-hlint
62-
-moduleName
6362
-qualifyImportedNames
6463
-refineImports
6564
-retrie

haskell-language-server.cabal

+1-1
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ common hlint
256256
cpp-options: -Dhlint
257257

258258
common moduleName
259-
if flag(moduleName) && (impl(ghc < 9.2.1) || flag(ignore-plugins-ghc-bounds))
259+
if flag(moduleName)
260260
build-depends: hls-module-name-plugin ^>=1.0.0.0
261261
cpp-options: -DmoduleName
262262

plugins/hls-module-name-plugin/hls-module-name-plugin.cabal

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
cabal-version: 2.4
22
name: hls-module-name-plugin
3-
version: 1.0.0.3
3+
version: 1.0.0.4
44
synopsis: Module name plugin for Haskell Language Server
55
description:
66
Please see the README on GitHub at <https://github.com/haskell/haskell-language-server#readme>

plugins/hls-module-name-plugin/src/Ide/Plugin/ModuleName.hs

+3-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
{-# LANGUAGE OverloadedStrings #-}
33
{-# LANGUAGE PatternSynonyms #-}
44
{-# LANGUAGE RecordWildCards #-}
5+
{-# LANGUAGE ViewPatterns #-}
56
{-# OPTIONS_GHC -Wall -Wwarn -fno-warn-type-defaults #-}
67

78
{- | Keep the module name in sync with its file path.
@@ -33,7 +34,7 @@ import Development.IDE (GetParsedModule (GetParsedModule),
3334
realSrcSpanToRange, runAction,
3435
uriToFilePath', use, use_)
3536
import Development.IDE.GHC.Compat (GenLocated (L), getSessionDynFlags,
36-
hsmodName, importPaths,
37+
hsmodName, importPaths, locA,
3738
pattern RealSrcSpan,
3839
pm_parsed_source, unLoc)
3940
import Ide.Types
@@ -138,7 +139,7 @@ pathModuleNames state normFilePath filePath
138139
codeModuleName :: IdeState -> NormalizedFilePath -> IO (Maybe (Range, T.Text))
139140
codeModuleName state nfp = runMaybeT $ do
140141
pm <- MaybeT . runAction "ModuleName.GetParsedModule" state $ use GetParsedModule nfp
141-
L (RealSrcSpan l _) m <- MaybeT . pure . hsmodName . unLoc $ pm_parsed_source pm
142+
L (locA -> (RealSrcSpan l _)) m <- MaybeT . pure . hsmodName . unLoc $ pm_parsed_source pm
142143
pure (realSrcSpanToRange l, T.pack $ show m)
143144

144145
-- traceAs :: Show a => String -> a -> a

stack-9.2.1.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ flags:
9797
haddockComments: false
9898
hlint: false
9999
importLens: false
100-
moduleName: false
100+
moduleName: true
101101
ormolu: false
102102
qualifyImportedNames: false
103103
refineImports: false

0 commit comments

Comments
 (0)