Closed antoyo closed 2 months ago
Hi, thanks for letting me know, I haven't seen this issue occur before. Do you perhaps remember which language server was active during the rename? If it occurs again, please don't hesitate to send me more details as you offered. Thank you!
This is rust-analyzer
.
Here's the output of :LspInfo
:
Language client log: /home/user/.local/state/nvim/lsp.log
Detected filetype: rust
1 client(s) attached to this buffer:
Client: rust_analyzer (id: 1, bufnr: [4, 12, 6])
filetypes: rust
autostart: true
root directory: /home/user/Ordinateur/Programmation/Rust/Projets/nox-lang/nox
cmd: /home/user/.cargo/bin/rust-analyzer
Configured servers list: clangd, pylsp, rust_analyzer
I'm encountering this one too, but only on my larger projects. I think it doesn't matter which language server it is because I have the same behavior with tsserver, clangd and pyright. My guess is the issue lies with the live preview when renaming. It can handle one character change but with the next one there is no preview anymore. On confirming the rename the following error pops up:
"[inc-rename] An error occurred in the preview function. Please report this error here: https://github.com/smjonas/inc-rename.nvim/issues:
Error executing Lua callback: .../share/nvim/lazy/inc-rename.nvim/lua/inc_rename/init.lua:328: Invalid 'end_col': out of range
stack traceback:
[C]: in function 'nvim_buf_set_text'
.../share/nvim/lazy/inc-rename.nvim/lua/inc_rename/init.lua:328: in function 'apply_highlights_fn'
.../share/nvim/lazy/inc-rename.nvim/lua/inc_rename/init.lua:374: in function <.../share/nvim/lazy/inc-rename.nvim/lua/inc_rename/init.lua:278>
Active language servers: { "tsserver" }
Buffer name: MY_CURRENT_BUFFER
@Moerliy Do you have an example project I can try to reproduce this with? I am unable to reproduce this error with tsserver. Please also let me know in which file the error occurred and on what identifier if possible.
@smjonas the projects I encountered it are unfortunately locked behind company policies. If I have some time tomorrow I will dig into it and try to find one that I can share.
@smjonas as promised a way of getting the issue consistently. If it doesn't work just let me know and we try something else.
SyncParseReturnType
.Something I noticed and could have the same root problem:
ParseContext
.@Moerliy Thanks a lot for the detailed instructions! That should help greatly with debugging. I will try to have a look at this next week :)
I'm also seeing this with rust-analyzer
. Using nightly and noice.nvim
if that matters.
Hi @Moerliy,
unfortunately I could not reproduce the issue you described:
When renaming SyncParseReturnType
, it looks just fine, too.
Which version of tsserver
are you using? I installed it with mason and am on the latest version (4.3.3
).
I'm using mason too so the same version.
Maybe there are some issues with other plugins i installed. If you want you can have a look at my nvim dotfiles. The should work out of the box if you ignore the chatgpt warning.
I get the same error sporadically but much more often since updating to nvim 0.10. Using the latest gopls language server.
Using lua_ls
(neovim 0.10.0) and getting the same issue.
"[inc-rename] An error occurred in the preview function. Please report this error here: https://github.com/smjonas/inc-rename.nvim/issues:
Error executing Lua callback: .../share/nvim/lazy/inc-rename.nvim/lua/inc_rename/init.lua:337: Invalid 'end_col': out of range
stack traceback:
^I[C]: in function 'nvim_buf_set_text'
^I.../share/nvim/lazy/inc-rename.nvim/lua/inc_rename/init.lua:337: in function 'apply_highlights_fn'
^I.../share/nvim/lazy/inc-rename.nvim/lua/inc_rename/init.lua:383: in function <.../share/nvim/lazy/inc-rename.nvim/lua/inc_rename/init.lua:287>
Active language servers: { "lua_ls" }
Maybe isolate this temporarily by falling back to LSP rename in case it fails? Thanks to anyone who jumps on this.
@joaomendoncaa thanks for reporting, would you mind sharing the file contents where this error occurred?
@joaomendoncaa thanks for reporting, would you mind sharing the file contents where this error occurred?
I tried to re-open the directory where it happened and sadly couldn't reproduce it again (cwd was in config.git's root). But I've had this issue on other ocasions with other LSPs. (hope that helps)
Meanwhile, I found another quirk when renaming certain namespaces and recorded it. (also happened before with other LSPs, but this is on lua_ls
) See video bellow on how :IncRename
is somehow infinitely repeating the characters I'm typing:
https://github.com/smjonas/inc-rename.nvim/assets/57664150/24df4bee-abaf-4b1e-aee6-dfd23d498d50
This might be happening for a thousand different reasons so, if needed, you can message me to help you debugging this, I don't have a lot of time to investigate it myself sadly.
Twitter: https://x.com/joaomendoncaaaa Telegram: https://t.me/joaomendoncaaa
Thank you, I was now able to produce the error with your dotfiles. I could also reproduce the other error with inccommand=split
which I will look into.
Awesome! Thank you for all your work Jonas. 🙏
@joaomendoncaa I fixed a bug that only occurred with inccommand=split
(that might explain the fact that I never noticed any issues). This suspicion is also supported by the fact that antoyo and Moerliy also have set inccommand=split
in their config.
Can you update the plugin and let me know if you can still reproduce the errors you mentioned? Thanks for your help.
@smjonas I just saw this and did some quick tests. Both, the example I mentioned earlier in the thread and and other in my bigger project seem to work. The lsp's I tested were tsserver, clangd and pyright. I did some load tests in c++ too. Did renaming for symbols with 100+ mentions across 10 files.
@joaomendoncaa I fixed a bug that only occurred with
inccommand=split
(that might explain the fact that I never noticed any issues). This suspicion is also supported by the fact that antoyo and Moerliy also haveset inccommand=split
in their config.Can you update the plugin and let me know if you can still reproduce the errors you mentioned? Thanks for your help.
Hey! Awesome news! 🙌
I roughly tested it aswell and the renaming feature seems to be working with only 2 minor issues:
inccommand=split
quickfix list is only updating the last item correctly (although all of them get correctly renamed)Quick demo
https://github.com/smjonas/inc-rename.nvim/assets/57664150/98408013-c139-44a3-bb20-41ea23bc4c00
@joaomendoncaa Thank you for testing as well! I also noticed this other issue - at least there is no crash now though ;) I will try to fix it this week.
Hey @smjonas! Hope you're safe and sound but I'm yet again the bearer of bad news! 😂
Found another bug on renaming where it doesn't replace the correct characters at all. This time around I have 3 clients attached to the buffer (tsserver
, typescript-tools
and tailwindcss
).
The demo bellow will try to replace initialSettings
to initial
in 2 places with the following errors:
(...) initialSettings: Settings (...)
to initialgs
(...) writable<Settings>(initialSettings);
to writable<Settings>(initial
So it both deletes more than the length of the replaced characters and sometimes leaves unwanted characters in place. I can't share the repo but let me know if I can give you anything else useful to debug the issue.
https://github.com/smjonas/inc-rename.nvim/assets/57664150/06c816bf-15d7-48b9-ba84-6dcb23c25521
@joaomendoncaa
inccommand=split quickfix list is only updating the last item correctly (although all of them get correctly renamed)
This issue should now be fixed, I added a test and can't reproduce it anymore
Found another bug on renaming where it doesn't replace the correct characters at all. This time around I have 3 clients attached to the buffer (tsserver, typescript-tools and tailwindcss).
The issue seems to be that you're using typescript-tools
and tsserver
at the same time. Make sure to uninstall tsserver
(this is also stated in the typescript-tools
readme).
Let me know if there are any remaining issues and thanks for all the great feedback and help! :)
🫶 🫵 @smjonas
Since there hasn't been any activity in this thread since the last commits, I will close this issue assuming the bugs have been fixed :) Please open a new issue if anyone still experiences similar issues.
Hi. Sometimes, when I try to rename an item, I get the following error:
I'm not exactly sure how to reproduce the issue, though, but perhaps I could point you to a project of mine where this happens if needed. Thanks to fix the issue.