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

Bug: Changing the current word under the cursor broken #45

Open
DMunkei opened this issue Nov 30, 2023 · 10 comments
Open

Bug: Changing the current word under the cursor broken #45

DMunkei opened this issue Nov 30, 2023 · 10 comments
Labels
bug Something isn't working status: needs repro

Comments

@DMunkei
Copy link

DMunkei commented Nov 30, 2023

Hey, when I use the snippet provided in the config to rename a variable it works, as long as I don't completely remove the previous variable. Hopefully the video explains it better.

Also an aside question, does this use the AST for renaming?

issue.mp4

This is how my config looks like right now. I'm using Lazy as my plugin manager

return {
  "smjonas/inc-rename.nvim",
  config = function()
    require("inc_rename").setup()
    vim.keymap.set("n", "<leader>rn", function()
      return ":IncRename " .. vim.fn.expand("<cword>")
    end, { expr = true })
  end,
}

This is the neovim version I'm running

➜ nvim --version
NVIM v0.9.1
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
@smjonas
Copy link
Owner

smjonas commented Dec 1, 2023

Thanks for reporting, I'll definitely look into this!

Also an aside question, does this use the AST for renaming?

It uses Nvim's builtin LSP functions (vim.lsp.buf.rename and another to get the locations of the variables), so it depends on the concrete LSP server for the current buffer. Although probably every LSP server constructs an AST of some kind.

@smjonas
Copy link
Owner

smjonas commented Dec 3, 2023

Which language server are you using? (output of :LspInfo?)

@smjonas smjonas added the bug Something isn't working label Dec 3, 2023
@DMunkei
Copy link
Author

DMunkei commented Dec 4, 2023

I was using Pyright and jedi-language-server.

@pmartinsdev
Copy link

Hy guys, any date to fix that issue ?? I had the same problem here using the "js/ts language server" at lazyvim

@DMunkei
Copy link
Author

DMunkei commented Mar 1, 2024

I've also had this issue constantly happening inside of TS while writing vuejs code. It somehow just deletes more than it should. Not sure why.

@smjonas
Copy link
Owner

smjonas commented Mar 2, 2024

Hy guys, any date to fix that issue ?? I had the same problem here using the "js/ts language server" at lazyvim

@pmartinsdev Thanks for also reporting this issue. Can you please provide me with example code where this is happening? It's hard for me to find out what the problem is without that.

@Moerliy
Copy link

Moerliy commented May 11, 2024

I mentioned this in #53 too.

Something I noticed and could have the same root problem:
1. Same project, same file
2. line 92 and try renaming ParseContext.
3. Add a couple of characters and have a look at the preview. With every new character added to the rename, the previously added characters should appear again with every new character you add. Hard to describe but the number of characters shown in the preview is the factorial of the number of characters added to the rename.
(not sure if you can reproduce it tho because that behavior is a bit less predictable)

You should be able to reproduce this with the second example.

@smjonas
Copy link
Owner

smjonas commented Sep 15, 2024

Did anyone still observe this issue? If not, this issue can be closed

@DMunkei
Copy link
Author

DMunkei commented Sep 15, 2024

I haven't used the pluggin in a while. I can try it out tomorrow and report if the issue persists. However I am not using the same machine as the one I reported the issue in.

@unphased
Copy link

I get this issue too!!! Started recently. Might have been from when i built neovim from source to update it recently.

NVIM v0.11.0-dev-782+ga0d8c2b86-Homebrew
Build type: Release
LuaJIT 2.1.1725453128

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

No branches or pull requests

5 participants