neovim icon indicating copy to clipboard operation
neovim copied to clipboard

Finalise the specification of how Go plugins will be written

Open myitcv opened this issue 9 years ago • 1 comments

  • Define a struct, e.g. example.Example, that implements neovim.Plugin
  • Via go generate tool, search for //neovim:wrapper Example Method1 directives to see which methods should have wrappers generated
  • Sync methods will be defined as:
// n args and m ret vals
// requires two error ret vals as last two return values

//neovim:wrapper Example SyncMethod
func (e *Example) SyncMethod(arg1 string, arg2 int, ...) (ret1 string, ret2 int, ..., error, error) {
  ...
}
  • Async methods will be defined as:
// n args
// single error ret val

//neovim:wrapper Example AsyncMethod
func (e *Example) AsyncMethod(arg1 string, arg2 int, ...) error {
  ...
}
  • Use msgp to generate MSGPACK wrappers around the wrappers
  • Define neovim methods that can be called during a plugin's Init method to register:
    • Command
    • Autocmd
    • Function
    • Plain RPC methods?

myitcv avatar Aug 25 '15 12:08 myitcv

Further notes here: https://github.com/myitcv/neovim/wiki/Plugin-defined-functions,-commands-and-autocommands

myitcv avatar Aug 28 '15 18:08 myitcv