weilbith / nvim-code-action-menu

Pop-up menu for code actions to show meta-information and diff preview
MIT License
577 stars 19 forks source link

Golang "Organize Imports" fails with an error when `vim.g.code_action_menu_show_diff` is enabled #37

Closed and3rson closed 2 years ago

and3rson commented 2 years ago

Neovim version: NVIM v0.7.0-dev+715-g1f3c0593e LSP server: gopls

Here's an error I'm getting when I do :CodeActionsMenu while vim.g.code_action_menu_show_diff is true:

Error detected while processing CursorMoved Autocommands for "<buffer=5>":
E5108: Error executing lua ...ode_action_menu/lsp_objects/edits/text_document_edit.lua:115: attempt to call field 'get_line' (a nil value)
stack traceback:
        ...ode_action_menu/lsp_objects/edits/text_document_edit.lua:115: in function 'get_list_of_original_lines'
        ...ode_action_menu/lsp_objects/edits/text_document_edit.lua:217: in function 'get_diff_lines'
        ...action-menu/lua/code_action_menu/windows/diff_window.lua:35: in function 'get_diff_lines_formatted'
        ...action-menu/lua/code_action_menu/windows/diff_window.lua:115: in function 'get_content'
        ...action-menu/lua/code_action_menu/windows/base_window.lua:30: in function 'update_buffer_content'
        ...action-menu/lua/code_action_menu/windows/base_window.lua:68: in function 'open'
        ...ker/start/nvim-code-action-menu/lua/code_action_menu.lua:98: in function 'update_diff_window'
        ...ker/start/nvim-code-action-menu/lua/code_action_menu.lua:105: in function 'update_selected_action'
        [string ":lua"]:1: in main chunk

If I disable vim.g.code_action_menu_show_diff, this works without any issues. Any ideas on this?

weilbith commented 2 years ago

Duplicate of #32. Fixed with #34.