avoid treesitter races in netrw previews

This commit is contained in:
Ray Elliott 2026-10-28 16:46:48 +00:00
commit fe94b30c31
4 changed files with 117 additions and 1 deletions

View file

@ -110,6 +110,11 @@ Regular files use netrw's native preview. Directories show a read-only summary o
their immediate children, including type, file size, modification time, and a
total for immediate files. Directories appear first, output is capped at 200
entries, and symbolic links are displayed without following them recursively.
File previews use Vim's syntax highlighting while Tree-sitter is suspended to
avoid asynchronous parser races during rapid replacement; normal Tree-sitter
highlighting resumes automatically when a previewed file is opened for editing.
Preview-only file buffers remain loaded but unlisted until Neovim exits, avoiding
the parser detachment that triggers this Neovim 0.12 race.
Opening a file with `<CR>`, `o`, `v`, or `t`, or otherwise leaving netrw, closes
the preview. Closing it manually also disables live updates until `p` is pressed