nvim-hs 0.2.1 → 0.2.2
raw patch · 4 files changed
+39/−18 lines, 4 files
Files
- library/Neovim/Main.hs +2/−2
- library/Neovim/Test.hs +29/−14
- nvim-hs.cabal +3/−2
- test-files/compile-error-for-quickfix-test6 +5/−0
library/Neovim/Main.hs view
@@ -68,9 +68,9 @@ <> help (unlines [ "Name that associates the plugin provider with neovim." , "This option has only an effect if you start nvim-hs"- , "with rpcstart() and use the factory method approach."+ , "with rpcstart()/jobstart() and use the factory method approach." , "Since it is extremely hard to figure that out inside"- , "nvim-hs, this options is assumed to used if the input"+ , "nvim-hs, this option is assumed to used if the input" , "and output is tied to standard in and standard out." ]))) <*> optional ((,)
library/Neovim/Test.hs view
@@ -23,13 +23,16 @@ import Control.Concurrent import Control.Concurrent.STM (atomically, putTMVar)+import Control.Exception.Lifted import Control.Monad.Reader (runReaderT) import Control.Monad.State (runStateT) import Control.Monad.Trans.Resource (runResourceT)+import GHC.IO.Exception (ioe_filename) import System.Directory import System.Exit (ExitCode (..)) import System.IO (Handle) import System.Process+import Text.PrettyPrint.ANSI.Leijen (red, text, putDoc, (<$$>)) -- | Type synonym for 'Word'.@@ -50,26 +53,38 @@ -> st -- ^ State -> Neovim r st a -- ^ Test case -> IO ()-testWithEmbeddedNeovim file timeout r st (Internal.Neovim a) = do- (_, _, ph, cfg) <- startEmbeddedNvim file timeout+testWithEmbeddedNeovim file timeout r st (Internal.Neovim a) =+ runTest `catch` catchIfNvimIsNotOnPath+ where+ runTest = do+ (_, _, ph, cfg) <- startEmbeddedNvim file timeout - let testCfg = Internal.retypeConfig r st cfg+ let testCfg = Internal.retypeConfig r st cfg - void $ runReaderT (runStateT (runResourceT a) st) testCfg+ void $ runReaderT (runStateT (runResourceT a) st) testCfg - -- vim_command isn't asynchronous, so we need to avoid waiting for the- -- result of the operation since neovim cannot send a result if it- -- has quit.- let Internal.Neovim q = vim_command "qa!"- void . forkIO . void $ runReaderT (runStateT (runResourceT q) st ) testCfg+ -- vim_command isn't asynchronous, so we need to avoid waiting for the+ -- result of the operation since neovim cannot send a result if it+ -- has quit.+ let Internal.Neovim q = vim_command "qa!"+ void . forkIO . void $ runReaderT (runStateT (runResourceT q) st ) testCfg - waitForProcess ph >>= \case- ExitFailure i ->- fail $ "Neovim returned with an exit status of: " ++ show i+ waitForProcess ph >>= \case+ ExitFailure i ->+ fail $ "Neovim returned with an exit status of: " ++ show i - ExitSuccess ->- return ()+ ExitSuccess ->+ return () ++catchIfNvimIsNotOnPath :: IOException -> IO ()+catchIfNvimIsNotOnPath e = case ioe_filename e of+ Just "nvim" ->+ putDoc . red $ text "The neovim executable 'nvim' is not on the PATH."+ <$$> text "You may not be testing fully!"++ _ ->+ throw e startEmbeddedNvim :: Maybe FilePath
nvim-hs.cabal view
@@ -1,5 +1,5 @@ name: nvim-hs-version: 0.2.1+version: 0.2.2 synopsis: Haskell plugin backend for neovim description: This package provides a plugin provider for neovim. It allows you to write@@ -26,7 +26,7 @@ license-file: LICENSE author: Sebastian Witte maintainer: woozletoff@gmail.com-copyright: Copyright 2015 Sebastian Witte <woozletoff@gmail.com>+copyright: Copyright 2017 Sebastian Witte <woozletoff@gmail.com> category: Editor build-type: Simple cabal-version: >=1.18@@ -37,6 +37,7 @@ , test-files/compile-error-for-quickfix-test3 , test-files/compile-error-for-quickfix-test4 , test-files/compile-error-for-quickfix-test5+ , test-files/compile-error-for-quickfix-test6 , test-files/hello , apiblobs/0.1.7.msgpack , api
+ test-files/compile-error-for-quickfix-test6 view
@@ -0,0 +1,5 @@++/home/test/.config/nvim/nvim.hs:8:7: error:+ • No instance for (Num String) arising from the literal ‘1’+ • In the expression: 1+ In an equation for ‘foo’: foo = 1