packages feed

hls-refine-imports-plugin 1.0.4.0 → 1.0.5.0

raw patch · 2 files changed

+28/−3 lines, 2 filesdep ~ghcidePVP ok

version bump matches the API change (PVP)

Dependency ranges changed: ghcide

API changes (from Hackage documentation)

Files

hls-refine-imports-plugin.cabal view
@@ -1,6 +1,6 @@ cabal-version:      2.4 name:               hls-refine-imports-plugin-version:            1.0.4.0+version:            1.0.5.0 synopsis:           Refine imports plugin for Haskell Language Server description:   Please see the README on GitHub at <https://github.com/haskell/haskell-language-server#readme>@@ -29,7 +29,7 @@     , containers     , deepseq     , ghc-    , ghcide                       ^>=1.9+    , ghcide                       ^>=1.10     , hls-explicit-imports-plugin  ^>=1.2     , hls-graph     , hls-plugin-api               ^>=1.6
src/Ide/Plugin/RefineImports.hs view
@@ -7,6 +7,7 @@ {-# LANGUAGE OverloadedStrings     #-} {-# LANGUAGE RecordWildCards       #-} {-# LANGUAGE TypeFamilies          #-}+{-# LANGUAGE CPP                   #-}  module Ide.Plugin.RefineImports (descriptor, Log(..)) where @@ -47,7 +48,19 @@ import           Ide.PluginUtils                      (mkLspCommand) import           Ide.Types import           Language.LSP.Server-import           Language.LSP.Types+import           Language.LSP.Types                   (ApplyWorkspaceEditParams (ApplyWorkspaceEditParams),+                                                       CodeAction (CodeAction, _command, _diagnostics, _disabled, _edit, _isPreferred, _kind, _title, _xdata),+                                                       CodeActionKind (CodeActionUnknown),+                                                       CodeActionParams (CodeActionParams),+                                                       CodeLens (..),+                                                       CodeLensParams (CodeLensParams, _textDocument),+                                                       Method (TextDocumentCodeAction, TextDocumentCodeLens),+                                                       SMethod (STextDocumentCodeAction, STextDocumentCodeLens, SWorkspaceApplyEdit),+                                                       TextDocumentIdentifier (TextDocumentIdentifier, _uri),+                                                       TextEdit (..),+                                                       WorkspaceEdit (..),+                                                       type (|?) (InR),+                                                       uriToNormalizedFilePath)  newtype Log = LogShake Shake.Log deriving Show @@ -200,7 +213,11 @@         :: LImportDecl GhcRn         -> Map.Map ModuleName [AvailInfo]         -> Maybe (Map.Map ModuleName [AvailInfo])+#if MIN_VERSION_ghc(9,5,0)+      filterByImport (L _ ImportDecl{ideclImportList = Just (_, L _ names)}) avails =+#else       filterByImport (L _ ImportDecl{ideclHiding = Just (_, L _ names)}) avails =+#endif         let importedNames = S.fromList $ map (ieName . unLoc) names             res = flip Map.filter avails $ \a ->                     any (`S.member` importedNames)@@ -222,10 +239,18 @@         -> LImportDecl GhcRn       constructImport         i@(L lim id@ImportDecl+#if MIN_VERSION_ghc(9,5,0)+                  {ideclName = L _ mn, ideclImportList = Just (hiding, L _ names)})+#else                   {ideclName = L _ mn, ideclHiding = Just (hiding, L _ names)})+#endif         (newModuleName, avails) = L lim id           { ideclName = noLocA newModuleName+#if MIN_VERSION_ghc(9,5,0)+          , ideclImportList = Just (hiding, noLocA newNames)+#else           , ideclHiding = Just (hiding, noLocA newNames)+#endif           }           where newNames = filter (\n -> any (n `containsAvail`) avails) names       constructImport lim _ = lim