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

'API info should be initialized by the time this is called' #49

Closed
jacobmischka opened this issue Dec 21, 2022 · 5 comments
Closed

'API info should be initialized by the time this is called' #49

jacobmischka opened this issue Dec 21, 2022 · 5 comments

Comments

@jacobmischka
Copy link

jacobmischka commented Dec 21, 2022

Describe the bug
Happens immediately on launch since the API info commit.

thread 'main' panicked at 'API info should be initialized by the time this is called', src/nvim/client.rs:112:14
stack backtrace:
   0: rust_begin_unwind
             at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/std/src/panicking.rs:584:5
   1: core::panicking::panic_fmt
             at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/core/src/panicking.rs:142:14
   2: core::panicking::panic_display
             at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/core/src/panicking.rs:72:5
   3: core::panicking::panic_str
             at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/core/src/panicking.rs:56:5
   4: core::option::expect_failed
             at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/core/src/option.rs:1880:5
   5: core::option::Option<T>::expect
             at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/core/src/option.rs:738:21
   6: nvim_gtk::nvim::client::NeovimClient::api_info
             at ./src/nvim/client.rs:108:9
   7: nvim_gtk::nvim::redraw_handler::call_gui_event
             at ./src/nvim/redraw_handler.rs:233:28
   8: nvim_gtk::nvim::handler::NvimHandler::nvim_cb::{{closure}}::{{closure}}
             at ./src/nvim/handler.rs:75:33
   9: nvim_gtk::nvim::handler::safe_call::{{closure}}
             at ./src/nvim/handler.rs:232:27
  10: glib::source::fnmut_callback_wrapper::{{closure}}
             at /Users/jacob/.cargo/registry/src/github.com-1ecc6299db9ec823/glib-0.16.7/src/source.rs:256:9
  11: glib::source::trampoline
             at /Users/jacob/.cargo/registry/src/github.com-1ecc6299db9ec823/glib-0.16.7/src/source.rs:112:5
  12: _g_main_context_dispatch
  13: _g_main_context_iterate
  14: _g_main_context_iteration
  15: _g_application_run
  16: <O as gio::application::ApplicationExtManual>::run_with_args
             at /Users/jacob/.cargo/registry/src/github.com-1ecc6299db9ec823/gio-0.16.7/src/application.rs:35:13
  17: <O as gio::application::ApplicationExtManual>::run
             at /Users/jacob/.cargo/registry/src/github.com-1ecc6299db9ec823/gio-0.16.7/src/application.rs:28:9
  18: nvim_gtk::main
             at ./src/main.rs:199:5
  19: core::ops::function::FnOnce::call_once
             at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/core/src/ops/function.rs:248:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

Technical information (please complete the following information):

  • OS: macOS
  • Neovim version: 0.8.1
  • Neovim-Gtk build version: 3ca13b3
@Lyude
Copy link
Owner

Lyude commented Dec 21, 2022

Do you set any neovim-gtk specific options in your .vimrc? That appears to be coming from a, rpcnotify(gui_fd, "Option", …) call, and those need to be in ginit.vim for the time being if you're going to use them at startup.

EDIT: almost forgot to mention as well, this is a bit of a silly limitation that's mentioned in daa84's neovim-gtk wiki. the problem is that the way we set gui options with rpc notifications is weird in general. There's actual neovim options for this we don't use yet which could be set in .vimrc/init.vim perfectly fine, but we instead have the weird custom rpcnotify(…). This is something I'm hoping to fix in a future release.

@jacobmischka
Copy link
Author

No, I don't. It doesn't happen with -- --clean, though, something must be causing it, I guess.

I'm setting some gui-specific variables, but they're not specific to nvim-gtk. Here's my entire .vimrc, not sure what might be causing it: https://github.com/jacobmischka/dotfiles/blob/main/.vimrc

None of my plugins seem to call anything suspicious either based on a grep in the plugin directory.

@jacobmischka
Copy link
Author

They are coming from my ginit.vim: https://github.com/jacobmischka/dotfiles/blob/main/.config/nvim/ginit.vim

[src/nvim/redraw_handler.rs:235] "Option" = "Option"
[src/nvim/redraw_handler.rs:235] &args = [
    String(
        Utf8String {
            s: Ok(
                "Tabline",
            ),
        },
    ),
    Integer(
        PosInt(
            0,
        ),
    ),
]
[src/nvim/redraw_handler.rs:235] api_info.is_some() = false
[src/nvim/redraw_handler.rs:235] "Option" = "Option"
[src/nvim/redraw_handler.rs:235] &args = [
    String(
        Utf8String {
            s: Ok(
                "Popupmenu",
            ),
        },
    ),
    Integer(
        PosInt(
            0,
        ),
    ),
]
[src/nvim/redraw_handler.rs:235] api_info.is_some() = false

@jacobmischka
Copy link
Author

Anyway, I did the minor amount of work to make api_info() return an Option, so feel free to merge if you want or close it if you want to address this some other way. Feels kind of weird to add that panic possibility if it's apparently pretty easy to trigger it, though.

@Lyude
Copy link
Owner

Lyude commented Dec 21, 2022

TBH I think what I might do is just remove the ext_* verification for those GUI option methods and continue working on other stuff. They're not really important and my hope is to actually deprecate them anyway and use global variables/built-in nvim options instead for configuring these things. That way we don't need to rely on RPC calls, and can just use autocmds (e.g. Subscription) which can be setup at any point during init . That also allows us to remove the requirement for things like ginit.vim
(actually changed my mind we probably do want this to be Option<…> anyway)

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

No branches or pull requests

2 participants