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
"body": "Note: I could be using this wrong.\r\n\r\nWhat I'm trying to do is use `RpcNotify` over the main `nvim` socket. So similar to the example remote plugin, but without the need for a nvim plugin + `jobstart`.\r\n\r\nMy code so far:\r\n\r\n```go\r\nfunc main() {\r\n\tnvim, err := waitForNvim(socketPath)\r\n\r\n\tif err != nil {\r\n\t\tfmt.Fprintf(os.Stderr, \"Error connecting to nvim: %v\\n\", err)\r\n\t\treturn\r\n\t}\r\n\r\n\tdefer nvim.Close()\r\n\r\n\tnvim.RegisterHandler(\"hello\", hello)\r\n}\r\n\r\nfunc waitForNvim(socketPath string) (*nvim.Nvim, error) {\r\n\tfor {\r\n\t\tnvim, err := nvim.Dial(socketPath)\r\n\r\n\t\tif err == nil {\r\n\t\t\t_, err := nvim.APIInfo()\r\n\r\n\t\t\tif err == nil {\r\n\t\t\t\treturn nvim, nil\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\ttime.Sleep(500 * time.Millisecond)\r\n\t}\r\n\r\n\t// return nil, errors.New(\"Timed out waiting for nvim\")\r\n}\r\n\r\nfunc hello(v *nvim.Nvim, args []string) {\r\n\tfmt.Println(fmt.Sprintf(\"Hello %s\\n\", strings.Join(args, \" \")))\r\n}\r\n```\r\n\r\nBut when I run `rpcnotifiy(0, 'hello', 'world')`, I'm not seeing the go `hello` function being called.\r\n\r\n---\r\n\r\nEdit: I should mention, the go code has been extracted from a project where the processing using neovim/go-client is kept open, just so we don't think the process is exiting immediately.",
"body": "Yep I see my problems now.\r\n\r\n- `nvim.Close()` shouldn't be called in `waitForNvim`\r\n- The `rpcnotify` from neovim should use the channel id",
0 commit comments