hls-explicit-imports-plugin 1.0.0.1 → 1.0.0.2
raw patch · 3 files changed
+14/−22 lines, 3 filesdep +hls-graphdep −shakedep ~ghcidePVP: minor bump suggested
API additions: PVP suggests at least a minor version bump
Dependencies added: hls-graph
Dependencies removed: shake
Dependency ranges changed: ghcide
API changes (from Hackage documentation)
+ Ide.Plugin.ExplicitImports: extractMinimalImports :: Maybe HscEnvEq -> Maybe TcModuleResult -> IO ([LImportDecl GhcRn], Maybe [LImportDecl GhcRn])
+ Ide.Plugin.ExplicitImports: within :: Range -> SrcSpan -> Bool
Files
- hls-explicit-imports-plugin.cabal +3/−5
- include/ghc-api-version.h +0/−10
- src/Ide/Plugin/ExplicitImports.hs +11/−7
hls-explicit-imports-plugin.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.2 name: hls-explicit-imports-plugin-version: 1.0.0.1+version: 1.0.0.2 synopsis: Explicit imports plugin for Haskell Language Server license: Apache-2.0 license-file: LICENSE@@ -9,7 +9,6 @@ category: Development build-type: Simple extra-source-files:- include/ghc-api-version.h LICENSE library@@ -21,16 +20,15 @@ , containers , deepseq , ghc- , ghcide ^>=1.2.0.0+ , ghcide ^>=1.3 , hls-plugin-api ^>=1.1 , lsp , lsp-types- , shake+ , hls-graph , text , unordered-containers default-language: Haskell2010- include-dirs: include default-extensions: DataKinds TypeOperators
− include/ghc-api-version.h
@@ -1,10 +0,0 @@-#ifndef GHC_API_VERSION_H-#define GHC_API_VERSION_H--#ifdef GHC_LIB-#define MIN_GHC_API_VERSION(x,y,z) MIN_VERSION_ghc_lib(x,y,z)-#else-#define MIN_GHC_API_VERSION(x,y,z) MIN_VERSION_ghc(x,y,z)-#endif--#endif
src/Ide/Plugin/ExplicitImports.hs view
@@ -9,9 +9,12 @@ {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TypeFamilies #-} -#include "ghc-api-version.h" -module Ide.Plugin.ExplicitImports (descriptor) where+module Ide.Plugin.ExplicitImports+ ( descriptor+ , extractMinimalImports+ , within+ ) where import Control.DeepSeq import Control.Monad.IO.Class@@ -26,7 +29,7 @@ import Development.IDE import Development.IDE.Core.PositionMapping import Development.IDE.GHC.Compat-import Development.Shake.Classes+import Development.IDE.Graph.Classes import GHC.Generics (Generic) import Ide.PluginUtils (mkLspCommand) import Ide.Types@@ -210,7 +213,8 @@ -- call findImportUsage does exactly what we need -- GHC is full of treats like this let usage = findImportUsage imports gblElts- (_, minimalImports) <- initTcWithGbl (hscEnv hsc) tcEnv span $ getMinimalImports usage+ (_, minimalImports) <-+ initTcWithGbl (hscEnv hsc) tcEnv span $ getMinimalImports usage -- return both the original imports and the computed minimal ones return (imports, minimalImports)@@ -249,11 +253,11 @@ -- create and return the code lens return $ Just CodeLens {..} +--------------------------------------------------------------------------------+ -- | A helper to run ide actions runIde :: IdeState -> Action a -> IO a-runIde state = runAction "importLens" state----------------------------------------------------------------------------------+runIde = runAction "importLens" within :: Range -> SrcSpan -> Bool within (Range start end) span =