nvim-hs 2.0.0.0 → 2.1.0.0
raw patch · 7 files changed
+24/−16 lines, 7 files
Files
- CHANGELOG.md +7/−0
- library/Neovim/API/TH.hs +1/−1
- library/Neovim/Plugin.hs +6/−5
- library/Neovim/Plugin/Classes.hs +5/−3
- library/Neovim/RPC/SocketReader.hs +1/−1
- nvim-hs.cabal +1/−1
- test-suite/Neovim/EmbeddedRPCSpec.hs +3/−5
CHANGELOG.md view
@@ -1,3 +1,10 @@+# 2.1.0.0++* Autocommands now take an additional parameter of type `Synchronous`, allowing+ them to execute synchronous (previously hardcoded as `Async`).+ In order to adapt to this, change ` $(autocmd 'handler) opts` to+ `$(autocmd 'handler) Async opts`.+ # 2.0.0.0 * Your configuration is now just a Haskell project. The dependency to Dyre has
library/Neovim/API/TH.hs view
@@ -452,7 +452,7 @@ (as, fun) <- functionImplementation functionName case as of [] ->- [|\t acmdOpts -> EF (Autocmd t (F (fromString $(litE (StringL (toUpper c : cs))))) acmdOpts, $(return fun))|]+ [|\t sync acmdOpts -> EF (Autocmd t (F (fromString $(litE (StringL (toUpper c : cs))))) sync acmdOpts, $(return fun))|] _ -> error "Autocmd functions have to be fully applied (i.e. they should not take any arguments)."
library/Neovim/Plugin.hs view
@@ -126,7 +126,7 @@ host +: functionName +: sync +: functionName +: copts +: [] logSuccess - Autocmd acmdType (F functionName) opts -> do+ Autocmd acmdType (F functionName) sync opts -> do pName <- getProviderName let (defineFunction, host) = either (\n -> ("remote#define#AutocmdOnHost", toObject n))@@ -142,7 +142,7 @@ return True flip catch reportError $ do void $ vim_call_function defineFunction $- host +: functionName +: Async +: acmdType +: opts +: []+ host +: functionName +: sync +: acmdType +: opts +: [] logSuccess @@ -190,7 +190,7 @@ where freeFun = \case- Autocmd event _ AutocmdOptions{..} -> do+ Autocmd event _ _ AutocmdOptions{..} -> do void . vim_command . unwords $ catMaybes [ Just "autocmd!", acmdGroup , Just (toString event) , Just acmdPattern@@ -242,14 +242,15 @@ -- addAutocmd :: ByteString -- ^ The event to register to (e.g. BufWritePost)+ -> Synchronous -> AutocmdOptions -> (Neovim env ()) -- ^ Fully applied function to register -> Neovim env (Maybe (Either (Neovim anyEnv ()) ReleaseKey)) -- ^ A 'ReleaseKey' if the registration worked-addAutocmd event (opts@AutocmdOptions{..}) f = do+addAutocmd event s (opts@AutocmdOptions{..}) f = do n <- newUniqueFunctionName- fmap snd <$> registerFunctionality (Autocmd event n opts) (\_ -> toObject <$> f)+ fmap snd <$> registerFunctionality (Autocmd event n s opts) (\_ -> toObject <$> f) -- | Create a listening thread for events and add update the 'FunctionMap' with
library/Neovim/Plugin/Classes.hs view
@@ -76,7 +76,7 @@ -- * Name of the command (must start with an uppercase letter) -- * Options to configure neovim's behavior for calling the command - | Autocmd ByteString FunctionName AutocmdOptions+ | Autocmd ByteString FunctionName Synchronous AutocmdOptions -- ^ Exported autocommand. Will call the given function if the type and -- filter match. --@@ -85,6 +85,7 @@ -- -- * Type of the autocmd (e.g. \"BufWritePost\") -- * Name for the function to call+ -- * Whether to use rpcrequest or rpcnotify -- * Options for the autocmd (use 'def' here if you don't want to change anything) deriving (Show, Read, Eq, Ord, Generic)@@ -101,8 +102,9 @@ Command fname copts -> "Command" <+> pretty copts <+> pretty fname - Autocmd t fname aopts ->+ Autocmd t fname s aopts -> "Autocmd" <+> pretty (decodeUtf8 t)+ <+> pretty s <+> pretty aopts <+> pretty fname @@ -443,5 +445,5 @@ name = \case Function n _ -> n Command n _ -> n- Autocmd _ n _ -> n+ Autocmd _ n _ _ -> n
library/Neovim/RPC/SocketReader.hs view
@@ -214,7 +214,7 @@ _ -> old -parseParams (Autocmd _ _ _) args = case args of+parseParams (Autocmd _ _ _ _) args = case args of [ObjectArray fArgs] -> fArgs _ -> args
nvim-hs.cabal view
@@ -1,5 +1,5 @@ name: nvim-hs-version: 2.0.0.0+version: 2.1.0.0 synopsis: Haskell plugin backend for neovim description: This package provides a plugin provider for neovim. It allows you to write
test-suite/Neovim/EmbeddedRPCSpec.hs view
@@ -1,5 +1,4 @@ {-# LANGUAGE LambdaCase #-}-{-# LANGUAGE QuasiQuotes #-} module Neovim.EmbeddedRPCSpec where @@ -24,16 +23,15 @@ import Path import Path.IO import System.Exit (ExitCode (..))-import System.IO (hClose) import System.Process.Typed spec :: Spec spec = parallel $ do- let helloFile = [relfile|test-files/hello|]- withNeovimEmbedded f a = testWithEmbeddedNeovim f (Seconds 3) () a+ let withNeovimEmbedded f a = testWithEmbeddedNeovim f (Seconds 3) () a describe "Read hello test file" .- it "should match 'Hello, World!'" . withNeovimEmbedded (Just helloFile) $ do+ it "should match 'Hello, World!'" . withNeovimEmbedded Nothing $ do+ nvim_command "edit test-files/hello" bs <- vim_get_buffers l <- vim_get_current_line liftIO $ l `shouldBe` "Hello, World!"