Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix config change notification using remote neovim #2067

Merged
merged 3 commits into from Oct 6, 2023

Conversation

mopp
Copy link
Contributor

@mopp mopp commented Oct 6, 2023

What kind of change does this PR introduce?

  • Fix

Did this PR introduce a breaking change?

A breaking change includes anything that breaks backwards compatibility either at compile or run time.

  • No

Background

I got the error below connecting remote neovim on my machine.

Error detected while processing function NeovideNotifycursor_animation_lengthChanged:
line     1:
E475: Invalid argument: Channel doesn't exist.
スクリーンショット 2023-10-06 19 23 09

g:neovide_channel_id has 3 in my environment.
But the embedded Vim script always uses 1.

What I did

This PR just makes it use g:neovide_channel_id.
I don't know how to write the tests.
Please tell me where I should put the tests or merge the PR and add tests in another PR 🙏

How to reproduce

macOS Monterey 12.6.7

> /opt/homebrew/bin/nvim --version
NVIM v0.9.2
Build type: Release
LuaJIT 2.1.0-beta3

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/opt/homebrew/Cellar/neovim/0.9.2/share/nvim"

Run :checkhealth for more info

> /opt/homebrew/bin/nvim --headless --listen localhost:6666 -u NONE
> neovide --version
neovide 0.11.2

> neovide --server=localhost:6666

Change a neovide config via command line mode on neovide started above.

let g:neovide_scroll_animation_length = 0.3

Then, neovide causes the error.

@mopp mopp changed the title use g:neovide_channel_id in NeovideNotify{0}Changed Fix config change notification using remote neovim Oct 6, 2023
@@ -153,7 +153,7 @@ pub async fn setup_neovide_specific_state(
.ok();

// Create auto command for retrieving exit code from neovim on quit.
nvim.command("autocmd VimLeave * call rpcnotify(1, 'neovide.quit', v:exiting)")
nvim.command("autocmd VimLeave * call rpcnotify(g:neovide_channel_id, 'neovide.quit', v:exiting)")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I faced the same error when I quit neovide by :q.

Copy link
Member

@fredizzimo fredizzimo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will also be partially fixed by #2062, but that one does not deal with the changed listeners, even if it probably should.

So, let's merge this one first.

@fredizzimo
Copy link
Member

@mopp,

The formatting is slightly wrong, but you can run cargo fmt to fix it.

@mopp
Copy link
Contributor Author

mopp commented Oct 6, 2023

@fredizzimo Thanks! I did cargo fmt 👍

@mopp mopp requested a review from fredizzimo October 6, 2023 11:32
@fredizzimo fredizzimo merged commit d61127f into neovide:main Oct 6, 2023
2 checks passed
@fredizzimo
Copy link
Member

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants