smjonas / inc-rename.nvim

Incremental LSP renaming based on Neovim's command-preview feature.
MIT License
624 stars 8 forks source link

Should not cause any error when trying to `<C-p>` after entering command mode by `:` #31

Closed nyngwang closed 1 year ago

nyngwang commented 1 year ago

Say I just rename a variable. Then, if I accidentally press<C-p>(to get the last command I called) too many times, then the renaming prompt will show up again and give me an error:

This bug is really annoying since the LSP client will simply stop working after the error. I hope it could be fixed soon...

   Error  14:03:00 msg_show.lua_error    restore_view_on_zoom_out Error executing vim.schedule lua callback: BufEnter Autocommands for "*": Vim(lua):E5108: Error executing lua Vim:E903: Process failed to start: too many open files: "/usr/bin/git"
stack traceback:
    [C]: in function 'jobstart'
    ...l/share/nvim/lazy/lualine.nvim/lua/lualine/utils/job.lua:9: in function 'start'
    ...zy/lualine.nvim/lua/lualine/components/diff/git_diff.lua:133: in function 'update_git_diff'
    ...zy/lualine.nvim/lua/lualine/components/diff/git_diff.lua:121: in function 'update_diff_args'
    [string ":lua"]:1: in main chunk
    [C]: in function 'bufload'
    .../share/nvim/lazy/inc-rename.nvim/lua/inc_rename/init.lua:55: in function 'cache_lines'
    .../share/nvim/lazy/inc-rename.nvim/lua/inc_rename/init.lua:121: in function 'handler'
    /usr/local/share/nvim/runtime/lua/vim/lsp.lua:1390: in function ''
    vim/_editor.lua: in function <vim/_editor.lua:0>
stack traceback:
    [C]: in function 'bufload'
    .../share/nvim/lazy/inc-rename.nvim/lua/inc_rename/init.lua:55: in function 'cache_lines'
    .../share/nvim/lazy/inc-rename.nvim/lua/inc_rename/init.lua:121: in function 'handler'
    /usr/local/share/nvim/runtime/lua/vim/lsp.lua:1390: in function ''
    vim/_editor.lua: in function <vim/_editor.lua:0>
smjonas commented 1 year ago

I could not reproduce your error with noice.nvim (steps: 1. rename, 2. press :, 3. keep ctrl-p pressed)

Since there is this line in the error message " ...l/share/nvim/lazy/lualine.nvim/lua/lualine/utils/job.lua:9: in function 'start'", can you share your lualine config? Also the noice config might be useful as well.

nyngwang commented 1 year ago

@smjonas Sorry for the late reply. Now I don't have the lualine error after many updates to my config, but ctrl-p still seems to call :Rename again and thus trigger the floating rename-bow/window. Is it possible to remove this command from the command history?

my lazy.nvim config ```lua { 'smjonas/inc-rename.nvim', config = function () require('inc_rename').setup { cmd_name = 'IncRename', preview_empty_name = true, show_message = true, } end }, ``` , ```lua require('noice').setup { lsp = { -- override markdown rendering so that **cmp** and other plugins use **Treesitter** override = { ['vim.lsp.util.convert_input_to_markdown_lines'] = true, ['vim.lsp.util.stylize_markdown'] = true, ['cmp.entry.get_documentation'] = true, }, signature = { enabled = false }, hover = { enabled = false }, messages = { view_search = false }, }, views = { cmdline_popup = G.extend(styles, { win_options = { winhighlight = { Normal = 'NoiceCmdlinePopup' }, winblend = 10, }, size = { height = 2 }, }), popupmenu = G.extend(styles, { win_options = { winhighlight = { Normal = 'NoiceCmdlineItems' }, winblend = 15, }, position = { row = offset_top+3 }, size = { height = 15 }, }), mini = { win_options = { winblend = 100 } }, }, presets = { lsp_doc_border = true, long_message_to_split = true, inc_rename = true, }, } ```

https://user-images.githubusercontent.com/24765272/229263950-458eb639-6dfb-47ac-933d-644f9f5b50bd.mov