Restore highlighting in netrw previews
Keep the loaded-buffer lifecycle protection while allowing Tree-sitter or Vim syntax highlighting; diagnostics and indent guides remain suppressed.
This commit is contained in:
parent
52f86a2ef9
commit
306b1c188c
3 changed files with 6 additions and 8 deletions
1
LOG.md
1
LOG.md
|
|
@ -227,6 +227,7 @@ Record every decision here with a short rationale. Append new entries; do not re
|
||||||
- 2026-10-28: Retired the completed migration's legacy configuration, vendored plugin archive, UltiSnips collection, validation workspaces, root test assets, superseded planning documents, and phase labels in active Lua comments. Git history now provides the historical archive. Persistent undo storage moved from the configuration repository to `stdpath('state')/undo`; the active README, architectural log, lockfile, colorscheme, spell data, and templates remain.
|
- 2026-10-28: Retired the completed migration's legacy configuration, vendored plugin archive, UltiSnips collection, validation workspaces, root test assets, superseded planning documents, and phase labels in active Lua comments. Git history now provides the historical archive. Persistent undo storage moved from the configuration repository to `stdpath('state')/undo`; the active README, architectural log, lockfile, colorscheme, spell data, and templates remain.
|
||||||
- 2026-10-28: Diagnosed the Tree-sitter `TSNode:range()` failure as the known incompatibility between Neovim 0.12 and nvim-treesitter's locked legacy `master` branch. Migrated nvim-treesitter and nvim-treesitter-textobjects to their rewritten `main` branches: native Neovim highlighting and incremental selection replace the old modules, textobjects use explicit mappings, indentation uses the new plugin expression when a query exists, and autotag retains its direct supported setup. Installed the verified official Tree-sitter CLI 0.26.9 binary in `~/.local/bin` after the system package required interactive sudo and Cargo compilation required unavailable libclang. Reinstalled all configured parsers in the new site directory and removed obsolete generated parser copies from the plugin checkout. The plugin audit confirmed every plugin is current for its configured branch or release constraint; nvim-surround remains on the latest release rather than its newer unreleased `main` commit.
|
- 2026-10-28: Diagnosed the Tree-sitter `TSNode:range()` failure as the known incompatibility between Neovim 0.12 and nvim-treesitter's locked legacy `master` branch. Migrated nvim-treesitter and nvim-treesitter-textobjects to their rewritten `main` branches: native Neovim highlighting and incremental selection replace the old modules, textobjects use explicit mappings, indentation uses the new plugin expression when a query exists, and autotag retains its direct supported setup. Installed the verified official Tree-sitter CLI 0.26.9 binary in `~/.local/bin` after the system package required interactive sudo and Cargo compilation required unavailable libclang. Reinstalled all configured parsers in the new site directory and removed obsolete generated parser copies from the plugin checkout. The plugin audit confirmed every plugin is current for its configured branch or release constraint; nvim-surround remains on the latest release rather than its newer unreleased `main` commit.
|
||||||
- 2026-10-28: Fixed stale deleted files persisting across session recreation. Deleting `Session.vim` did not clear the in-memory argument list or listed buffers, so `:mksession` serialized the removed diagnostics fixture again. Session load and exit-time save now discard unmodified nonexistent local-file buffers and missing argument-list entries before restoring or writing the session; real files, URI buffers, unnamed buffers, and modified buffers remain protected.
|
- 2026-10-28: Fixed stale deleted files persisting across session recreation. Deleting `Session.vim` did not clear the in-memory argument list or listed buffers, so `:mksession` serialized the removed diagnostics fixture again. Session load and exit-time save now discard unmodified nonexistent local-file buffers and missing argument-list entries before restoring or writing the session; real files, URI buffers, unnamed buffers, and modified buffers remain protected.
|
||||||
|
- 2026-10-28: Re-enabled highlighted netrw file previews after migrating to the Neovim 0.12-compatible nvim-treesitter `main` branch. Preview buffers retain native Tree-sitter or Vim syntax highlighting, while diagnostics and indent guides remain suppressed. The existing loaded-but-unlisted buffer lifecycle protection remains in place so the original unload behavior is not restored. An automated 80-transition Markdown/Lua/JSON/CSS/HTML stress test and subsequent normal use passed without `TSNode:range()` errors, so the trial was adopted as the permanent behavior.
|
||||||
|
|
||||||
## Project-Local Configuration
|
## Project-Local Configuration
|
||||||
|
|
||||||
|
|
|
||||||
11
README.md
11
README.md
|
|
@ -116,12 +116,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
|
their immediate children, including type, file size, modification time, and a
|
||||||
total for immediate files. Directories appear first, output is capped at 200
|
total for immediate files. Directories appear first, output is capped at 200
|
||||||
entries, and symbolic links are displayed without following them recursively.
|
entries, and symbolic links are displayed without following them recursively.
|
||||||
File previews suppress syntax highlighting, Tree-sitter, diagnostics, and indent
|
File previews retain Tree-sitter or Vim syntax highlighting while suppressing
|
||||||
guides so rapidly replaced content remains plain and quiet. Normal highlighting
|
diagnostics and indent guides. The buffer's prior diagnostic and indent-guide
|
||||||
and the buffer's prior diagnostic/indent-guide state return automatically when a
|
state returns automatically when a previewed file is opened for editing.
|
||||||
previewed file is opened for editing.
|
Preview-only file buffers remain loaded but unlisted until Neovim exits, retaining
|
||||||
Preview-only file buffers remain loaded but unlisted until Neovim exits, avoiding
|
the lifecycle protection added for rapid preview replacement.
|
||||||
the parser detachment that triggers this Neovim 0.12 race.
|
|
||||||
|
|
||||||
Opening a file with `<CR>`, `o`, `v`, or `t`, or otherwise leaving netrw, closes
|
Opening a file with `<CR>`, `o`, `v`, or `t`, or otherwise leaving netrw, closes
|
||||||
the preview. Closing it manually or pressing `p` again disables live updates
|
the preview. Closing it manually or pressing `p` again disables live updates
|
||||||
|
|
|
||||||
|
|
@ -502,9 +502,7 @@ local function show_native_preview(state, entry)
|
||||||
vim.bo[preview_buf].bufhidden = 'hide'
|
vim.bo[preview_buf].bufhidden = 'hide'
|
||||||
vim.bo[preview_buf].buflisted = preview_buffers[preview_buf].buflisted
|
vim.bo[preview_buf].buflisted = preview_buffers[preview_buf].buflisted
|
||||||
vim.b[preview_buf].netrw_live_preview_buffer = true
|
vim.b[preview_buf].netrw_live_preview_buffer = true
|
||||||
pcall(vim.treesitter.stop, preview_buf)
|
|
||||||
vim.diagnostic.enable(false, { bufnr = preview_buf })
|
vim.diagnostic.enable(false, { bufnr = preview_buf })
|
||||||
vim.bo[preview_buf].syntax = ''
|
|
||||||
set_indent_guides(preview_buf, false)
|
set_indent_guides(preview_buf, false)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue