You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I am still hesitant when it comes to haskell, especially when TemplateHaskell is involved.
I would like to parse the output of menu_get("") from my haskell plugin but not sure how
let json = vim_command "menu_get('')"
-- case AE.eitherDecode json of
-- Left err -> err $ "could not decode the output of menu_get"
-- Right menuEntries -> return
The text was updated successfully, but these errors were encountered:
vim_command returns no value as indicated by the unit () in the type.
If you start a ghci session from within neovim (i.e. starting a terminal with :term and then run stack ghci), then you can call remote functions and see what they return. For example calling menu_get with an empty String as the only argument can be achieved by the following:
import Neovim.Debug
import qualified Neovim.API.String as Str
:+ prepends a value to a list just like : except that it additionally converts it to a messagepack Object.
Anyhow, the result is a messagepack object, which is very similar to a JSON object. It is already a structured object and you can pattern match on it to extract the values you want.
Alternatively, you can implement an NvimObject instance which requires the data type to have FromJSON and ToJSON instances. Then you can use Aeson's mechanisms to parse the object as if it were JSON. This would also implement #74 :-)
Hi, I am still hesitant when it comes to haskell, especially when TemplateHaskell is involved.
I would like to parse the output of menu_get("") from my haskell plugin but not sure how
The text was updated successfully, but these errors were encountered: