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

Variable name not picked #73

Open
WECLEYArtz opened this issue Jan 7, 2025 · 3 comments
Open

Variable name not picked #73

WECLEYArtz opened this issue Jan 7, 2025 · 3 comments
Labels
bug Something isn't working

Comments

@WECLEYArtz
Copy link

As far as i understood from the plugin shortcut <leader>vrn, it picks the name to be renamed, and change it with the new name on the command.
However in my case it doesn't seem to pick anything, my config

inc_rename.bug.mp4

leaving me with this errror

Error executing Lua callback: /usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:291: Cannot serialise function: type not supported                           
stack traceback:                                                                                                                                       
^I[C]: in function 'encode'                                                                                                                            
^I/usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:291: in function 'encode_and_send'                                                                       
^I/usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:338: in function 'request'                                                                               
^I/usr/share/nvim/runtime/lua/vim/lsp/client.lua:679: in function 'request'                                                                            
^I/usr/share/nvim/runtime/lua/vim/lsp.lua:882: in function 'buf_request'                                                                               
^I.../share/nvim/lazy/inc-rename.nvim/lua/inc_rename/init.lua:210: in function 'check_can_rename_at_position'                                          
^I.../share/nvim/lazy/inc-rename.nvim/lua/inc_rename/init.lua:426: in function <.../share/nvim/lazy/inc-rename.nvim/lua/inc_rename/init.lua:414>       
Active language servers: { "lua_ls" }                                                                                                                  
Buffer name: /home/wec/.dotphile/nvim/lua/neowec/remap.lua ```

@smjonas smjonas added the bug Something isn't working label Jan 7, 2025
smjonas added a commit that referenced this issue Jan 16, 2025
Silences the error in #73, but I'm unsure about the actual reason
why the error occurs.
@smjonas
Copy link
Owner

smjonas commented Jan 16, 2025

I'm not sure what's causing this issue, does it still occur for you after the latest commit? If yes, which Nvim version are you using (run nvim --version)?

@WECLEYArtz
Copy link
Author

i don't think it's fixed for me, and

NVIM v0.11.0-dev-559+g0a0962a2e
Build type: RelWithDebInfo
LuaJIT 2.1.1720049189

@Muizzyranking
Copy link

Try setting your keymap like this

vim.keymap.set("n", "<leader>vrn", function()
  -- requiring it to make sure inc_rename is loaded

  local ok, _ = pcall(require, "inc_rename")
  if ok then
    return ":IncRename " .. vim.fn.expand("<cword>")
  end
end, { expr = true, silent = false, desc = "Rename" })

You can put it in your lsp keymaps and check if the current lsp has rename capabilities so the command would not work if the lsp does not have rename capabilities (this is optional).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants