nvim-hs-ghcid 1.0.0.0 → 2.0.0.0
raw patch · 4 files changed
+33/−19 lines, 4 filesdep +nvim-hs-ghciddep ~basedep ~ghciddep ~nvim-hsnew-component:exe:nvim-hs-ghcidPVP ok
version bump matches the API change (PVP)
Dependencies added: nvim-hs-ghcid
Dependency ranges changed: base, ghcid, nvim-hs, nvim-hs-contrib
API changes (from Hackage documentation)
- Neovim.Ghcid: plugin :: Neovim (StartupConfig NeovimConfig) NeovimPlugin
+ Neovim.Ghcid: plugin :: Neovim () NeovimPlugin
Files
- Neovim/Ghcid.hs +2/−2
- Neovim/Ghcid/Plugin.hs +10/−11
- executable/Main.hs +7/−0
- nvim-hs-ghcid.cabal +14/−6
Neovim/Ghcid.hs view
@@ -1,4 +1,3 @@-{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE TemplateHaskell #-} {- | Module : Neovim.Ghcid@@ -15,10 +14,11 @@ where import Neovim+import Neovim.API.String import Neovim.Ghcid.Plugin -plugin :: Neovim (StartupConfig NeovimConfig) NeovimPlugin+plugin :: Neovim () NeovimPlugin plugin = do _ <- vim_command "sign define GhcidWarn text=>> texthl=Search" _ <- vim_command "sign define GhcidErr text=!! texthl=ErrorMsg"
Neovim/Ghcid/Plugin.hs view
@@ -1,6 +1,4 @@ {-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE LambdaCase #-}-{-# LANGUAGE OverloadedStrings #-} {- | Module : Neovim.Ghcid.Plugin Description : Ghcid quickfix integration plugin@@ -18,6 +16,7 @@ import Data.Yaml import GHC.Generics import Neovim+import Neovim.API.String import Neovim.BuildTool import Neovim.Quickfix as Q import Neovim.User.Choice (yesOrNo)@@ -32,12 +31,12 @@ import qualified Data.ByteString as BS import Data.Either (rights) import Data.List (groupBy, sort)-import Data.Map (Map)-import qualified Data.Map as Map+import Data.Map.Strict (Map)+import qualified Data.Map.Strict as Map import Data.Maybe (mapMaybe) import System.FilePath+import UnliftIO.Exception (SomeException (..), catch) import UnliftIO.STM-import UnliftIO.Exception (SomeException(..), catch) -- | Simple data type containing a few information on how to start ghcid.@@ -85,7 +84,7 @@ -- confirmed all settings. ghcidStart :: CommandArguments -> Neovim GhcidEnv () ghcidStart copts = do- currentBufferPath <- errOnInvalidResult $ vim_call_function "expand" [ObjectBinary "%:p:h"]+ currentBufferPath <- fromObjectUnsafe <$> vim_call_function "expand" [ObjectBinary "%:p:h"] liftIO (determineProjectSettings' currentBufferPath) >>= \case Nothing -> void $ yesOrNo "Could not determine project settings. This plugin needs a project with a .cabal file to work."@@ -118,7 +117,7 @@ `catch` \(SomeException e) -> err . pretty $ "Failed to start ghcid session: " <> show e applyQuickfixActions $ loadToQuickfix ls void $ vim_command "cwindow"- ra <- addAutocmd "BufWritePost" def (startOrReload s) >>= \case+ ra <- addAutocmd "BufWritePost" Sync def (startOrReload s) >>= \case Nothing -> return $ return () @@ -160,7 +159,7 @@ (Left lnum, Right f) -> do let signType = case errorType q of- Q.Error -> "GhcidErr"+ Q.Error -> "GhcidErr" Q.Warning -> "GhcidWarn" -- TODO What if the file name contains spaces?@@ -172,7 +171,7 @@ -- | Stop a ghcid session associated to the currently active buffer. ghcidStop :: CommandArguments -> Neovim GhcidEnv () ghcidStop _ = do- d <- errOnInvalidResult $ vim_call_function "expand" [ObjectBinary "%:p:h"]+ d <- fromObjectUnsafe <$> vim_call_function "expand" [ObjectBinary "%:p:h"] sessions <- atomically .readTVar =<< asks startedSessions case Map.lookupLE d sessions of Nothing ->@@ -206,7 +205,7 @@ dropWarningsIfErrorsArePresent xs = case filter ((== Q.Error) . errorType) xs of- [] -> xs+ [] -> xs xs' -> xs' @@ -237,7 +236,7 @@ (Cabal _, d) -> return $ ProjectSettings (getDirectory d) "cabal repl" (Custom, d) -> do f <- MaybeT $ mkFile (Just d) "ghcid.yaml"- MaybeT $ decode <$> BS.readFile (getFile f)+ MaybeT $ decodeThrow <$> BS.readFile (getFile f) _ -> MaybeT $ return Nothing
+ executable/Main.hs view
@@ -0,0 +1,7 @@+module Main where++import Neovim+import qualified Neovim.Ghcid as Ghcid++main :: IO ()+main = neovim defaultConfig { plugins = [ Ghcid.plugin ] }
nvim-hs-ghcid.cabal view
@@ -1,5 +1,5 @@ name: nvim-hs-ghcid-version: 1.0.0.0+version: 2.0.0.0 synopsis: Neovim plugin that runs ghcid to update the quickfix list description: This plugin uses the nvim-hs plugin backend for neovim and fills the quickfix list on file-saves with the errors and@@ -34,16 +34,24 @@ extra-source-files: README.md cabal-version: >=1.10 +executable nvim-hs-ghcid+ main-is: Main.hs+ hs-source-dirs: executable+ default-language: Haskell2010+ build-depends: base >=4.9 && <5, nvim-hs, nvim-hs-ghcid+ ghc-options: -threaded -rtsopts -with-rtsopts=-N+ library exposed-modules: Neovim.Ghcid, Neovim.Ghcid.Plugin -- other-modules:- other-extensions: OverloadedStrings, TemplateHaskell, DeriveGeneric, LambdaCase- build-depends: base >=4.6 && <5- , nvim-hs >=1.0 && <2- , nvim-hs-contrib >=1.0 && <2+ default-extensions: OverloadedStrings, LambdaCase+ other-extensions: TemplateHaskell, DeriveGeneric+ build-depends: base >=4.9 && <5+ , nvim-hs >=2 && <3+ , nvim-hs-contrib >=2.0 && <3 , containers >=0.5 , yaml- , ghcid >=0.6.1+ , ghcid >=0.6.1 && <1 , resourcet , bytestring , directory