chrisgrieser / nvim-puppeteer

Automatically convert strings to f-strings or template strings and back.
MIT License
61 stars 4 forks source link

[Bug]: replaceNodeText sometimes called with wrong end_row #11

Closed MoritzBoehme closed 11 months ago

MoritzBoehme commented 1 year ago

Bug Description

I have had this issue for a while now, that when I rename a variable in a large python files via python-lsp-server I get the following error. I could not yet reproduce this error for smaller python files.

Renamed 1 instance in 1 file
Error detected while processing TextChanged Autocommands for "<buffer=2>":
Error executing lua callback: ...-puppeteer-unstable-2023-11-13_1a941a8/lua/puppeteer.lua:10: Invalid 'end_row': out of range
stack traceback:
        [C]: in function 'nvim_buf_set_text'
        ...-puppeteer-unstable-2023-11-13_1a941a8/lua/puppeteer.lua:10: in function 'replaceNodeText'
        ...-puppeteer-unstable-2023-11-13_1a941a8/lua/puppeteer.lua:93: in function <...-puppeteer-unstable-2023-11-13_1a941a8/lua/puppeteer.lua:70>

I have also updated my treesitter grammars, but the error persists. In my current config I am using inc-rename.nvim to rename the variable, but I just tried the native vim.lsp.buf.rename() as well, which also throws the same error.

Relevant Screenshot

No response

To Reproduce

Will try to add a minimal config and file which triggers this issue.

neovim version

NVIM v0.10.0-dev-9dc4404
Build type: Release
LuaJIT 2.1.1693350652

and

NVIM v0.10.0-dev-7ca2d64
Build type: Release
LuaJIT 2.1.1693350652

Make sure you have done the following

chrisgrieser commented 11 months ago

yeah, I think that has to do with Treesitter simply choking on files that are too large. I'm afraid there is little I can do on my side there, sorry.