hls-rename-plugin 2.4.0.0 → 2.5.0.0
raw patch · 2 files changed
+4/−24 lines, 2 filesdep ~ghcidedep ~hls-plugin-apidep ~hls-test-utils
Dependency ranges changed: ghcide, hls-plugin-api, hls-test-utils
Files
- hls-rename-plugin.cabal +4/−4
- src/Ide/Plugin/Rename.hs +0/−20
hls-rename-plugin.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.4 name: hls-rename-plugin-version: 2.4.0.0+version: 2.5.0.0 synopsis: Rename plugin for Haskell Language Server description: Please see the README on GitHub at <https://github.com/haskell/haskell-language-server#readme>@@ -34,11 +34,11 @@ , extra , ghc , ghc-exactprint- , ghcide == 2.4.0.0+ , ghcide == 2.5.0.0 , hashable , hiedb , hie-compat- , hls-plugin-api == 2.4.0.0+ , hls-plugin-api == 2.5.0.0 , hls-refactor-plugin , lens , lsp@@ -69,4 +69,4 @@ , filepath , hls-plugin-api , hls-rename-plugin- , hls-test-utils == 2.4.0.0+ , hls-test-utils == 2.5.0.0
src/Ide/Plugin/Rename.hs view
@@ -12,10 +12,8 @@ module Ide.Plugin.Rename (descriptor, E.Log) where -#if MIN_VERSION_ghc(9,2,1) import GHC.Parser.Annotation (AnnContext, AnnList, AnnParen, AnnPragma)-#endif import Compat.HieTypes import Control.Lens ((^.))@@ -139,13 +137,8 @@ annAst <- runActionE "Rename.GetAnnotatedParsedSource" state (useE GetAnnotatedParsedSource nfp) let (ps, anns) = (astA annAst, annsA annAst)-#if !MIN_VERSION_ghc(9,2,1)- let src = T.pack $ exactPrint ps anns- res = T.pack $ exactPrint (updatePs ps) anns-#else let src = T.pack $ exactPrint ps res = T.pack $ exactPrint (updatePs ps)-#endif pure $ diffText ccs (verTxtDocId, src) res IncludeDeletions -- | Replace names at every given `Location` (in a given `ParsedSource`) with a given new name.@@ -154,7 +147,6 @@ HashSet Location -> ParsedSource -> ParsedSource-#if MIN_VERSION_ghc(9,2,1) replaceRefs newName refs = everywhere $ -- there has to be a better way... mkT (replaceLoc @AnnListItem) `extT`@@ -169,14 +161,6 @@ replaceLoc (L srcSpan oldRdrName) | isRef (locA srcSpan) = L srcSpan $ replace oldRdrName replaceLoc lOldRdrName = lOldRdrName-#else-replaceRefs newName refs = everywhere $ mkT replaceLoc- where- replaceLoc :: Located RdrName -> Located RdrName- replaceLoc (L srcSpan oldRdrName)- | isRef srcSpan = L srcSpan $ replace oldRdrName- replaceLoc lOldRdrName = lOldRdrName-#endif replace :: RdrName -> RdrName replace (Qual modName _) = Qual modName newName replace _ = Unqual newName@@ -238,12 +222,8 @@ where go :: HieASTs a -> HieASTs a go hf =-#if MIN_VERSION_ghc(9,2,1) HieASTs (fmap goAst (getAsts hf)) goAst (Node nsi sp xs) = Node (SourcedNodeInfo $ M.restrictKeys (getSourcedNodeInfo nsi) (S.singleton SourceInfo)) sp (map goAst xs)-#else- hf-#endif -- head is safe since groups are non-empty collectWith :: (Hashable a, Eq a, Eq b) => (a -> b) -> HashSet a -> [(b, HashSet a)]