Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix module-name plugin on ghc-9.2.1 #2594

Merged
merged 4 commits into from
Jan 16, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ jobs:
name: Test hls-hlint-plugin test suite
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"

- if: matrix.test && matrix.ghc != '9.2.1'
- if: matrix.test
name: Test hls-module-name-plugin test suite
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"

Expand Down
2 changes: 1 addition & 1 deletion cabal-ghc921.project
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ constraints:
-eval
-haddockComments
-hlint
-moduleName
+moduleName
jneira marked this conversation as resolved.
Show resolved Hide resolved
-qualifyImportedNames
-refineImports
-retrie
Expand Down
2 changes: 1 addition & 1 deletion haskell-language-server.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ common hlint
cpp-options: -Dhlint

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

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cabal-version: 2.4
name: hls-module-name-plugin
version: 1.0.0.3
version: 1.0.0.4
synopsis: Module name plugin for Haskell Language Server
description:
Please see the README on GitHub at <https://github.com/haskell/haskell-language-server#readme>
Expand Down
5 changes: 3 additions & 2 deletions plugins/hls-module-name-plugin/src/Ide/Plugin/ModuleName.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE ViewPatterns #-}
{-# OPTIONS_GHC -Wall -Wwarn -fno-warn-type-defaults #-}

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

-- traceAs :: Show a => String -> a -> a
Expand Down
2 changes: 1 addition & 1 deletion stack-9.2.1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ flags:
haddockComments: false
hlint: false
importLens: false
moduleName: false
moduleName: true
ormolu: false
qualifyImportedNames: false
refineImports: false
Expand Down