wookayin / semshi

🌈 Semantic Highlighting for Python in Neovim
79 stars 5 forks source link

Invalid window id error during execution of `mark_selected` #3

Closed wookayin closed 1 year ago

wookayin commented 1 year ago
Exception: Invalid window id: 1011

semshi/rplugin/python3/semshi/plugin.py", line 104, in event_cursor_moved
    self._mark_selected()
semshi/rplugin/python3/semshi/plugin.py", line 242, in _mark_selected
    self._cur_handler.mark_selected(self._vim.current.window.cursor)
.../site-packages/pynvim/api/window.py", line 22, in cursor
    return self.request('nvim_win_get_cursor')
.../site-packages/pynvim/api/common.py", line 58, in request
    return self._session.request(name, self, *args, **kwargs),
.../site-packages/pynvim/api/nvim.py", line 182, in request
    res = self._session.request(name, *args, **kwargs)
.../site-packages/pynvim/msgpack_rpc/session.py", line 102, in request
    raise self.error_wrapper(err)

Often happens while executing SemshiCursorMoved. Probably the same bug as https://github.com/numirias/semshi/issues/72

wookayin commented 1 year ago

We might need to check if a window is valid, using e.g., nvim_win_is_valid(), but a simple workaround is to ignore this specific type of exceptions.

wookayin commented 1 year ago

Fixed https://github.com/numirias/semshi/issues/72 in 43b4660 and 6bfa733.