hls-module-name-plugin 1.0.1.0 → 1.0.2.0
raw patch · 5 files changed
+14/−6 lines, 5 filesdep ~ghcidedep ~hls-plugin-apidep ~hls-test-utilsnew-uploaderPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: ghcide, hls-plugin-api, hls-test-utils
API changes (from Hackage documentation)
Files
- hls-module-name-plugin.cabal +4/−4
- src/Ide/Plugin/ModuleName.hs +2/−2
- test/Main.hs +6/−0
- test/testdata/CorrectName.hs +1/−0
- test/testdata/hie.yaml +1/−0
hls-module-name-plugin.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.4 name: hls-module-name-plugin-version: 1.0.1.0+version: 1.0.2.0 synopsis: Module name plugin for Haskell Language Server description: Please see the README on GitHub at <https://github.com/haskell/haskell-language-server#readme>@@ -25,8 +25,8 @@ , base >=4.12 && <5 , directory , filepath- , ghcide ^>=1.6- , hls-plugin-api ^>=1.3+ , ghcide ^>=1.7+ , hls-plugin-api ^>=1.4 , lsp , text , transformers@@ -44,4 +44,4 @@ , base , filepath , hls-module-name-plugin- , hls-test-utils ^>=1.2+ , hls-test-utils ^>=1.3
src/Ide/Plugin/ModuleName.hs view
@@ -36,7 +36,7 @@ import Development.IDE.GHC.Compat (GenLocated (L), getSessionDynFlags, hsmodName, importPaths, locA, pattern RealSrcSpan,- pm_parsed_source, unLoc)+ pm_parsed_source, unLoc, moduleNameString) import Ide.Types import Language.LSP.Server import Language.LSP.Types hiding@@ -140,7 +140,7 @@ codeModuleName state nfp = runMaybeT $ do pm <- MaybeT . runAction "ModuleName.GetParsedModule" state $ use GetParsedModule nfp L (locA -> (RealSrcSpan l _)) m <- MaybeT . pure . hsmodName . unLoc $ pm_parsed_source pm- pure (realSrcSpanToRange l, T.pack $ show m)+ pure (realSrcSpanToRange l, T.pack $ moduleNameString m) -- traceAs :: Show a => String -> a -> a -- traceAs lbl a = trace (lbl ++ " = " ++ show a) a
test/Main.hs view
@@ -37,6 +37,12 @@ [CodeLens { _command = Just c }] <- getCodeLenses doc executeCommand c void $ skipManyTill anyMessage (message SWorkspaceApplyEdit)+ , testCase "Should not show code lens if the module name is correct" $+ runSessionWithServer moduleNamePlugin testDataDir $ do+ doc <- openDoc "CorrectName.hs" "haskell"+ lenses <- getCodeLenses doc+ liftIO $ lenses @?= []+ closeDoc doc ] goldenWithModuleName :: TestName -> FilePath -> (TextDocumentIdentifier -> Session ()) -> TestTree
+ test/testdata/CorrectName.hs view
@@ -0,0 +1,1 @@+module CorrectName where
test/testdata/hie.yaml view
@@ -5,3 +5,4 @@ - "TEmptyModule" - "TWrongModuleName" - "mainlike"+ - "CorrectName"