hsdev 0.1.7.1 → 0.1.7.2
raw patch · 2 files changed
+29/−2 lines, 2 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
+ HsDev.Stack: stackArch :: String
+ HsDev.Stack: stackCompiler :: MaybeT IO String
- HsDev.Project: entity :: Lens (Extensions a_a11gl) (Extensions a_a13oA) a_a11gl a_a13oA
+ HsDev.Project: entity :: Lens (Extensions a_aZFS) (Extensions a_a11Q2) a_aZFS a_a11Q2
- HsDev.Project: extensions :: Lens' (Extensions a_a11gl) [Extension]
+ HsDev.Project: extensions :: Lens' (Extensions a_aZFS) [Extension]
- HsDev.Project: ghcOptions :: Lens' (Extensions a_a11gl) [String]
+ HsDev.Project: ghcOptions :: Lens' (Extensions a_aZFS) [String]
- HsDev.Server.Message: message :: Lens (Message a_aG5h) (Message a_aGg4) a_aG5h a_aGg4
+ HsDev.Server.Message: message :: Lens (Message a_aG5j) (Message a_aGg6) a_aG5j a_aGg6
- HsDev.Server.Message: messageId :: Lens' (Message a_aG5h) (Maybe String)
+ HsDev.Server.Message: messageId :: Lens' (Message a_aG5j) (Maybe String)
- HsDev.Symbols.Types: inspectedId :: Lens (Inspected i_a1mg9 a_a1mga) (Inspected i_a1ogw a_a1mga) i_a1mg9 i_a1ogw
+ HsDev.Symbols.Types: inspectedId :: Lens (Inspected i_a1kJr a_a1kJs) (Inspected i_a1mJO a_a1kJs) i_a1kJr i_a1mJO
- HsDev.Symbols.Types: inspection :: Lens' (Inspected i_a1mg9 a_a1mga) Inspection
+ HsDev.Symbols.Types: inspection :: Lens' (Inspected i_a1kJr a_a1kJs) Inspection
- HsDev.Symbols.Types: inspectionResult :: Lens (Inspected i_a1mg9 a_a1mga) (Inspected i_a1mg9 a_a1ogx) (Either String a_a1mga) (Either String a_a1ogx)
+ HsDev.Symbols.Types: inspectionResult :: Lens (Inspected i_a1kJr a_a1kJs) (Inspected i_a1kJr a_a1mJP) (Either String a_a1kJs) (Either String a_a1mJP)
- HsDev.Tools.Types: note :: Lens (Note a_a1MW9) (Note a_a1N5A) a_a1MW9 a_a1N5A
+ HsDev.Tools.Types: note :: Lens (Note a_a1Lpv) (Note a_a1LyW) a_a1Lpv a_a1LyW
- HsDev.Tools.Types: noteLevel :: Lens' (Note a_a1MW9) (Maybe Severity)
+ HsDev.Tools.Types: noteLevel :: Lens' (Note a_a1Lpv) (Maybe Severity)
- HsDev.Tools.Types: noteRegion :: Lens' (Note a_a1MW9) Region
+ HsDev.Tools.Types: noteRegion :: Lens' (Note a_a1Lpv) Region
- HsDev.Tools.Types: noteSource :: Lens' (Note a_a1MW9) ModuleLocation
+ HsDev.Tools.Types: noteSource :: Lens' (Note a_a1Lpv) ModuleLocation
Files
- hsdev.cabal +1/−1
- src/HsDev/Stack.hs +28/−1
hsdev.cabal view
@@ -2,7 +2,7 @@ -- see http://haskell.org/cabal/users-guide/ name: hsdev -version: 0.1.7.1 +version: 0.1.7.2 synopsis: Haskell development library and tool with support of autocompletion, symbol info, go to declaration, find references etc. description: Haskell development library and tool with support of autocompletion, symbol info, go to declaration, find references, hayoo search etc.
src/HsDev/Stack.hs view
@@ -8,6 +8,8 @@ getStackEnv, projectEnv, stackPackageDbStack, + stackCompiler, stackArch, + MaybeT(..) ) where @@ -20,21 +22,46 @@ import Data.Maybe import Data.Map (Map) import qualified Data.Map as M +import Distribution.Compiler +import Distribution.System +import qualified Distribution.Text as T (display) import System.Directory import System.Environment import System.FilePath import System.Process +import qualified GHC +import qualified Packages as GHC + import HsDev.PackageDb +import HsDev.Scan.Browse (withPackages) import HsDev.Util (withCurrentDirectory) +-- | Get compiler version +stackCompiler :: MaybeT IO String +stackCompiler = exceptToMaybeT $ do + res <- withPackages ["-no-user-package-db"] $ + return . + map (GHC.packageNameString &&& GHC.packageVersion) . + fromMaybe [] . + GHC.pkgDatabase + let + compiler = T.display buildCompilerFlavor + CompilerId _ version = buildCompilerId + ver = maybe (T.display version) T.display $ lookup compiler res + return $ compiler ++ "-" ++ ver + +-- | Get arch for stack +stackArch :: String +stackArch = T.display buildArch -- | Invoke stack command, we are trying to get actual stack near current hsdev executable stack :: [String] -> MaybeT IO String stack cmd = do curExe <- liftIO getExecutablePath withCurrentDirectory (takeDirectory curExe) $ do stackExe <- MaybeT $ findExecutable "stack" - liftIO $ readProcess stackExe cmd "" + comp <- stackCompiler + liftIO $ readProcess stackExe (cmd ++ ["--compiler", comp, "--arch", stackArch]) "" -- | Make yaml opts yaml :: Maybe FilePath -> [String]