supermaven-inc / supermaven-nvim

The official Neovim plugin for Supermaven
https://supermaven.com/
MIT License
729 stars 38 forks source link

Error detected while processing CursorMoved Autocommands #79

Open alvarosevilla95 opened 3 months ago

alvarosevilla95 commented 3 months ago

I've been using the plugin for a few days. Love it so far, but after a while of editing I eventually start to get this error (which triggers on pretty much every key press, making it unusuable):

Error detected while processing CursorMoved Autocommands for "*":
Error executing lua callback: ...permaven-nvim/lua/supermaven-nvim/completion_preview.lua:98: Invalid buffer id: 407
stack traceback:
        [C]: in function 'nvim_buf_del_extmark'
        ...permaven-nvim/lua/supermaven-nvim/completion_preview.lua:98: in function 'dispose_inlay'
        ...maven-nvim/lua/supermaven-nvim/binary/binary_handler.lua:108: in function 'on_update'
        ...upermaven-nvim/lua/supermaven-nvim/document_listener.lua:32: in function <...upermaven-nvim/lua/supermaven-nvim/document_listener.lua:26>

I can't really figure out how reproduce reliably though, if I can I will update the issue

iamim commented 3 months ago

Observed this as well.

Roman- commented 3 months ago

I have this after opening and closing the Telescope window, but not every time. It is pretty annoying as I have to restart the editor, closing all the tabs which completely disrupts the workflow.

AlejandroSuero commented 2 months ago

@alvarosevilla95 @Roman- @iamim which versions of nvim are you using?

Seems like it's trying to delete the "ghost text" but out of the intended buffer. I tried with going back to alpha(nvim dashboard), into mason, into lazy, into telescope and into quickfixlist. Also opening various buffers, windows and tabs, but I can't trigger it.

https://github.com/user-attachments/assets/28a11a88-dda7-457d-bc38-a4f66904d4c4

The text in the demo was done by adding this on top of supermaven-nvim/completion_preview:98:

local log = require("supermaven-nvim.logger")
log:debug("------------------- buf name ---------------------")
log:debug(vim.inspect(vim.api.nvim_buf_get_name(buf)))
log:debug("------------------- buf name ---------------------")
log:debug("----------------- buf and ns_id ------------------")
log:debug(vim.inspect(buf))
log:debug(vim.inspect(self.ns_id))
log:debug("----------------- buf and ns_id ------------------")
log:debug("------------------- extmarks ---------------------")
log:debug(vim.inspect(vim.api.nvim_buf_get_extmarks(buf, self.ns_id, 0, -1, { details = true, hl_name = true, type = "virt_text" })))
log:debug("------------------- extmarks ---------------------")
:SupermavenShowLog ```txt [TRACE Fri Sep 13 16:43:17 2024] Starting Supermaven... [TRACE Fri Sep 13 16:43:21 2024] Supermaven Free Tier is running. [DEBUG Fri Sep 13 16:43:21 2024] ------------------- buf name --------------------- [DEBUG Fri Sep 13 16:43:21 2024] "/Users/aome/dev/nvim_plugins/supermaven-nvim/lua/supermaven-nvim/util.lua" [DEBUG Fri Sep 13 16:43:21 2024] ------------------- buf name --------------------- [DEBUG Fri Sep 13 16:43:21 2024] ----------------- buf and ns_id ------------------ [DEBUG Fri Sep 13 16:43:21 2024] 14 [DEBUG Fri Sep 13 16:43:21 2024] 10 [DEBUG Fri Sep 13 16:43:21 2024] ----------------- buf and ns_id ------------------ [DEBUG Fri Sep 13 16:43:21 2024] ------------------- extmarks --------------------- [DEBUG Fri Sep 13 16:43:21 2024] {} [DEBUG Fri Sep 13 16:43:21 2024] ------------------- extmarks --------------------- [DEBUG Fri Sep 13 16:43:21 2024] ------------------- buf name --------------------- [DEBUG Fri Sep 13 16:43:21 2024] "/Users/aome/dev/nvim_plugins/supermaven-nvim/lua/supermaven-nvim/util.lua" [DEBUG Fri Sep 13 16:43:21 2024] ------------------- buf name --------------------- [DEBUG Fri Sep 13 16:43:21 2024] ----------------- buf and ns_id ------------------ [DEBUG Fri Sep 13 16:43:21 2024] 14 [DEBUG Fri Sep 13 16:43:21 2024] 10 [DEBUG Fri Sep 13 16:43:21 2024] ----------------- buf and ns_id ------------------ [DEBUG Fri Sep 13 16:43:21 2024] ------------------- extmarks --------------------- [DEBUG Fri Sep 13 16:43:21 2024] { { 1, 1, 2, { hl_mode = "combine", ns_id = 10, priority = 4096, right_gravity = true, virt_text = { { "ocal", "Comment" } }, virt_text_hide = false, virt_text_pos = "win_col", virt_text_repeat_linebreak = false, virt_text_win_col = 1 } } } [DEBUG Fri Sep 13 16:43:21 2024] ------------------- extmarks --------------------- [DEBUG Fri Sep 13 16:43:21 2024] ------------------- buf name --------------------- [DEBUG Fri Sep 13 16:43:21 2024] "/Users/aome/dev/nvim_plugins/supermaven-nvim/lua/supermaven-nvim/util.lua" [DEBUG Fri Sep 13 16:43:21 2024] ------------------- buf name --------------------- [DEBUG Fri Sep 13 16:43:21 2024] ----------------- buf and ns_id ------------------ [DEBUG Fri Sep 13 16:43:21 2024] 14 [DEBUG Fri Sep 13 16:43:21 2024] 10 [DEBUG Fri Sep 13 16:43:21 2024] ----------------- buf and ns_id ------------------ [DEBUG Fri Sep 13 16:43:21 2024] ------------------- extmarks --------------------- [DEBUG Fri Sep 13 16:43:21 2024] { { 1, 1, 2, { hl_mode = "combine", ns_id = 10, priority = 4096, right_gravity = true, virt_text = { { "cal utils =", "Comment" } }, virt_text_hide = false, virt_text_pos = "win_col", virt_text_repeat_linebreak = false, virt_text_win_col = 2 } } } [DEBUG Fri Sep 13 16:43:21 2024] ------------------- extmarks --------------------- [DEBUG Fri Sep 13 16:43:21 2024] ------------------- buf name --------------------- [DEBUG Fri Sep 13 16:43:21 2024] "/Users/aome/dev/nvim_plugins/supermaven-nvim/lua/supermaven-nvim/util.lua" [DEBUG Fri Sep 13 16:43:21 2024] ------------------- buf name --------------------- [DEBUG Fri Sep 13 16:43:21 2024] ----------------- buf and ns_id ------------------ [DEBUG Fri Sep 13 16:43:21 2024] 14 [DEBUG Fri Sep 13 16:43:21 2024] 10 [DEBUG Fri Sep 13 16:43:21 2024] ----------------- buf and ns_id ------------------ [DEBUG Fri Sep 13 16:43:21 2024] ------------------- extmarks --------------------- [DEBUG Fri Sep 13 16:43:21 2024] { { 1, 1, 2, { hl_mode = "combine", ns_id = 10, priority = 4096, right_gravity = true, virt_text = { { 'cal utils = require("supermaven-nvim', "Comment" } }, virt_text_hide = false, virt_text_pos = "win_col", virt_text_repeat_linebreak = false, virt_text_win_col = 2 } } } [DEBUG Fri Sep 13 16:43:21 2024] ------------------- extmarks --------------------- [DEBUG Fri Sep 13 16:43:21 2024] ------------------- buf name --------------------- [DEBUG Fri Sep 13 16:43:21 2024] "/Users/aome/dev/nvim_plugins/supermaven-nvim/lua/supermaven-nvim/util.lua" [DEBUG Fri Sep 13 16:43:21 2024] ------------------- buf name --------------------- [DEBUG Fri Sep 13 16:43:21 2024] ----------------- buf and ns_id ------------------ [DEBUG Fri Sep 13 16:43:21 2024] 14 [DEBUG Fri Sep 13 16:43:21 2024] 10 [DEBUG Fri Sep 13 16:43:21 2024] ----------------- buf and ns_id ------------------ [DEBUG Fri Sep 13 16:43:21 2024] ------------------- extmarks --------------------- [DEBUG Fri Sep 13 16:43:21 2024] { { 1, 1, 3, { hl_mode = "combine", ns_id = 10, priority = 4096, right_gravity = true, virt_text = { { 'cal utils = require("supermaven-nvim.utils")', "Comment" } }, virt_text_hide = false, virt_text_pos = "win_col", virt_text_repeat_linebreak = false, virt_text_win_col = 2 } } } [DEBUG Fri Sep 13 16:43:21 2024] ------------------- extmarks --------------------- [DEBUG Fri Sep 13 16:43:21 2024] ------------------- buf name --------------------- [DEBUG Fri Sep 13 16:43:21 2024] "/Users/aome/dev/nvim_plugins/supermaven-nvim/lua/supermaven-nvim/util.lua" [DEBUG Fri Sep 13 16:43:21 2024] ------------------- buf name --------------------- [DEBUG Fri Sep 13 16:43:21 2024] ----------------- buf and ns_id ------------------ [DEBUG Fri Sep 13 16:43:21 2024] 14 [DEBUG Fri Sep 13 16:43:21 2024] 10 [DEBUG Fri Sep 13 16:43:21 2024] ----------------- buf and ns_id ------------------ [DEBUG Fri Sep 13 16:43:21 2024] ------------------- extmarks --------------------- [DEBUG Fri Sep 13 16:43:21 2024] { { 1, 1, 3, { hl_mode = "combine", ns_id = 10, priority = 4096, right_gravity = true, virt_text = { { 'al utils = require("supermaven-nvim.utils")', "Comment" } }, virt_text_hide = false, virt_text_pos = "win_col", virt_text_repeat_linebreak = false, virt_text_win_col = 3 } } } [DEBUG Fri Sep 13 16:43:21 2024] ------------------- extmarks --------------------- [DEBUG Fri Sep 13 16:43:21 2024] ------------------- buf name --------------------- [DEBUG Fri Sep 13 16:43:21 2024] "/Users/aome/dev/nvim_plugins/supermaven-nvim/lua/supermaven-nvim/util.lua" [DEBUG Fri Sep 13 16:43:21 2024] ------------------- buf name --------------------- [DEBUG Fri Sep 13 16:43:21 2024] ----------------- buf and ns_id ------------------ [DEBUG Fri Sep 13 16:43:21 2024] 14 [DEBUG Fri Sep 13 16:43:21 2024] 10 [DEBUG Fri Sep 13 16:43:21 2024] ----------------- buf and ns_id ------------------ [DEBUG Fri Sep 13 16:43:21 2024] ------------------- extmarks --------------------- [DEBUG Fri Sep 13 16:43:21 2024] { { 1, 1, 3, { hl_mode = "combine", ns_id = 10, priority = 4096, right_gravity = true, virt_text = { { 'al utils = require("supermaven-nvim.utils")', "Comment" } }, virt_text_hide = false, virt_text_pos = "win_col", virt_text_repeat_linebreak = false, virt_text_win_col = 3 } } } [DEBUG Fri Sep 13 16:43:21 2024] ------------------- extmarks --------------------- [DEBUG Fri Sep 13 16:43:21 2024] ------------------- buf name --------------------- [DEBUG Fri Sep 13 16:43:21 2024] "/Users/aome/dev/nvim_plugins/supermaven-nvim/lua/supermaven-nvim/util.lua" [DEBUG Fri Sep 13 16:43:21 2024] ------------------- buf name --------------------- [DEBUG Fri Sep 13 16:43:21 2024] ----------------- buf and ns_id ------------------ [DEBUG Fri Sep 13 16:43:21 2024] 14 [DEBUG Fri Sep 13 16:43:21 2024] 10 [DEBUG Fri Sep 13 16:43:21 2024] ----------------- buf and ns_id ------------------ [DEBUG Fri Sep 13 16:43:21 2024] ------------------- extmarks --------------------- [DEBUG Fri Sep 13 16:43:21 2024] { { 1, 1, 4, { hl_mode = "combine", ns_id = 10, priority = 4096, right_gravity = true, virt_text = { { 'al utils = require("supermaven-nvim.utils")', "Comment" } }, virt_text_hide = false, virt_text_pos = "win_col", virt_text_repeat_linebreak = false, virt_text_win_col = 3 } } } [DEBUG Fri Sep 13 16:43:21 2024] ------------------- extmarks --------------------- [DEBUG Fri Sep 13 16:43:22 2024] ------------------- buf name --------------------- [DEBUG Fri Sep 13 16:43:22 2024] "/Users/aome/dev/nvim_plugins/supermaven-nvim/lua/supermaven-nvim/util.lua" [DEBUG Fri Sep 13 16:43:22 2024] ------------------- buf name --------------------- [DEBUG Fri Sep 13 16:43:22 2024] ----------------- buf and ns_id ------------------ [DEBUG Fri Sep 13 16:43:22 2024] 14 [DEBUG Fri Sep 13 16:43:22 2024] 10 [DEBUG Fri Sep 13 16:43:22 2024] ----------------- buf and ns_id ------------------ [DEBUG Fri Sep 13 16:43:22 2024] ------------------- extmarks --------------------- [DEBUG Fri Sep 13 16:43:22 2024] { { 1, 1, 5, { hl_mode = "combine", ns_id = 10, priority = 4096, right_gravity = true, virt_text = { { 'l utils = require("supermaven-nvim.utils")', "Comment" } }, virt_text_hide = false, virt_text_pos = "win_col", virt_text_repeat_linebreak = false, virt_text_win_col = 4 } } } [DEBUG Fri Sep 13 16:43:22 2024] ------------------- extmarks --------------------- [DEBUG Fri Sep 13 16:43:22 2024] ------------------- buf name --------------------- [DEBUG Fri Sep 13 16:43:22 2024] "/Users/aome/dev/nvim_plugins/supermaven-nvim/lua/supermaven-nvim/util.lua" [DEBUG Fri Sep 13 16:43:22 2024] ------------------- buf name --------------------- [DEBUG Fri Sep 13 16:43:22 2024] ----------------- buf and ns_id ------------------ [DEBUG Fri Sep 13 16:43:22 2024] 14 [DEBUG Fri Sep 13 16:43:22 2024] 10 [DEBUG Fri Sep 13 16:43:22 2024] ----------------- buf and ns_id ------------------ [DEBUG Fri Sep 13 16:43:22 2024] ------------------- extmarks --------------------- [DEBUG Fri Sep 13 16:43:22 2024] { { 1, 1, 5, { hl_mode = "combine", ns_id = 10, priority = 4096, right_gravity = true, virt_text = { { ' utils = require("supermaven-nvim.utils")', "Comment" } }, virt_text_hide = false, virt_text_pos = "win_col", virt_text_repeat_linebreak = false, virt_text_win_col = 5 } } } [DEBUG Fri Sep 13 16:43:22 2024] ------------------- extmarks --------------------- [DEBUG Fri Sep 13 16:43:23 2024] ------------------- buf name --------------------- [DEBUG Fri Sep 13 16:43:23 2024] "/Users/aome/dev/nvim_plugins/supermaven-nvim/lua/supermaven-nvim/util.lua" [DEBUG Fri Sep 13 16:43:23 2024] ------------------- buf name --------------------- [DEBUG Fri Sep 13 16:43:23 2024] ----------------- buf and ns_id ------------------ [DEBUG Fri Sep 13 16:43:23 2024] 14 [DEBUG Fri Sep 13 16:43:23 2024] 10 [DEBUG Fri Sep 13 16:43:23 2024] ----------------- buf and ns_id ------------------ [DEBUG Fri Sep 13 16:43:23 2024] ------------------- extmarks --------------------- [DEBUG Fri Sep 13 16:43:23 2024] {} [DEBUG Fri Sep 13 16:43:23 2024] ------------------- extmarks --------------------- ```

If you add this and can reproduce it, paste the logs so it's easier to track the error.

[!Note] You will need to add or modify the log_level config option in your own config.

--- supermaven plugin config
--- ...
log_level = "debug"
poeck commented 1 month ago

Also facing this issue quite often, not sure when exactly it happens. Restarting neovim usually fixes it for me.