Files
neovim/runtime/lua/vim
notomo 58d85cd03d fix(treesitter): ensure window is valid in async parsing #34385
Problem: Error occurs if window is invalid in the middle of parsing.

Solution: Check if window is valid in parsing.

- Error
```
vim.schedule callback: ...im/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:485: Invalid window id: 1037
stack traceback:
	[C]: in function 'nvim__redraw'
	...im/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:485: in function 'cb'
	...m/share/nvim/runtime/lua/vim/treesitter/languagetree.lua:494: in function '_run_async_callbacks'
	...m/share/nvim/runtime/lua/vim/treesitter/languagetree.lua:550: in function <...m/share/nvim/runtime/lua/vim/treesitter/languagetree.lua:529>
```

- Reproduce script
```lua
local bufnr = vim.api.nvim_create_buf(false, true)
local many_lines = vim.fn["repeat"]({ "local test = 'a'" }, 100000)
vim.api.nvim_buf_set_lines(bufnr, 0, -1, false, many_lines)
local window = vim.api.nvim_open_win(bufnr, true, {
  relative = "editor",
  row = 0,
  col = 0,
  width = 10,
  height = 10,
})
vim.bo.filetype = "lua"
vim.schedule(function()
  vim.api.nvim_win_close(window, true)
end)
```
2025-06-08 16:44:40 -07:00
..
2025-06-08 09:59:02 +08:00
2025-06-06 15:36:48 +01:00
2025-06-06 15:36:48 +01:00
2025-06-06 15:36:48 +01:00
2025-06-06 15:36:48 +01:00
2025-06-06 15:36:48 +01:00
2025-06-07 07:49:04 -07:00
2025-06-06 15:36:48 +01:00
2025-06-06 15:36:48 +01:00
2025-06-06 15:36:48 +01:00
2025-06-06 15:36:48 +01:00
2025-06-06 15:36:48 +01:00
2025-04-27 13:40:46 -07:00
2025-06-06 15:36:48 +01:00
2025-03-15 15:00:44 +01:00
2025-06-06 15:36:48 +01:00
2025-06-06 15:36:48 +01:00
2025-06-06 15:36:48 +01:00
2025-06-06 15:36:48 +01:00
2025-06-06 15:36:48 +01:00
2025-06-06 15:36:48 +01:00