fix(nvim): port config to nvim-treesitter main rewrite for 26.05 #126

Merged
dominik.polakovics merged 1 commit from fix/nvim-2605 into main 2026-06-07 19:53:17 +02:00

Problem

After upgrading nb to NixOS 26.05, neovim failed on startup with
nvim-treesitter.configs not found.

Root cause (confirmed empirically)

26.05 ships the nvim-treesitter "main"-branch rewrite
(0.10.0-unstable) on neovim 0.12.2. The rewrite removed the
nvim-treesitter.configs module entirely. Because the whole lua config is
one concatenated lua << EOF … EOF chunk, the error at treesitter.lua
(file 12 of 17) aborted everything after it — so treesitter-textobjects,
utils (none-ls), bufferline, which-key and sops silently never
loaded either.

Changes

File Fix
treesitter.lua (fatal) highlight via native vim.treesitter.start() in a FileType autocmd; drop dead rainbow/autotag/context_commentstring keys + upstream-removed incremental_selection
treesitter-textobjects.lua (fatal) rewrite to the new select API; add the nvim-treesitter-textobjects plugin (it was never installed — af/if/ac/ic never worked before)
utils.lua drop none-ls diagnostics.eslint (builtin removed upstream)
project.lua use_lsp/ignore_lsp → nested lsp = { enabled, ignore }
init.lua deprecated get_active_clients()get_clients({bufnr}); fix broken client.detach()buf_detach_client()
which-key.lua, bufferline.lua deprecated nvim_buf_get_optionvim.bo[]
default.nix add nvim-treesitter-textobjects + alejandra/deadnix/statix/cppcheck (the none-ls sources that were warning "not executable")

Verification

Built the full 26.05 plugin set and ran the config headless on real
neovim 0.12.2
: clean startup (zero errors/warnings), treesitter
highlight attaches on a .nix file (non-bundled grammar → withAllGrammars
works), none-ls loads and deadnix runs.

The shared development module is also built on the 25.11 dev VM (under
fw); the new textobjects config safely no-ops there (the old plugin lacks
the new module path). That VM is being upgraded to 26.05 anyway.

## Problem After upgrading `nb` to NixOS 26.05, neovim failed on startup with `nvim-treesitter.configs not found`. ## Root cause (confirmed empirically) 26.05 ships the nvim-treesitter **"main"-branch rewrite** (`0.10.0-unstable`) on **neovim 0.12.2**. The rewrite removed the `nvim-treesitter.configs` module entirely. Because the whole lua config is one concatenated `lua << EOF … EOF` chunk, the error at `treesitter.lua` (file 12 of 17) aborted everything after it — so `treesitter-textobjects`, `utils` (none-ls), `bufferline`, `which-key` and `sops` silently never loaded either. ## Changes | File | Fix | |------|-----| | `treesitter.lua` | **(fatal)** highlight via native `vim.treesitter.start()` in a FileType autocmd; drop dead `rainbow`/`autotag`/`context_commentstring` keys + upstream-removed `incremental_selection` | | `treesitter-textobjects.lua` | **(fatal)** rewrite to the new select API; add the `nvim-treesitter-textobjects` plugin (it was never installed — `af/if/ac/ic` never worked before) | | `utils.lua` | drop none-ls `diagnostics.eslint` (builtin removed upstream) | | `project.lua` | `use_lsp`/`ignore_lsp` → nested `lsp = { enabled, ignore }` | | `init.lua` | deprecated `get_active_clients()` → `get_clients({bufnr})`; fix broken `client.detach()` → `buf_detach_client()` | | `which-key.lua`, `bufferline.lua` | deprecated `nvim_buf_get_option` → `vim.bo[]` | | `default.nix` | add `nvim-treesitter-textobjects` + `alejandra`/`deadnix`/`statix`/`cppcheck` (the none-ls sources that were warning "not executable") | ## Verification Built the full 26.05 plugin set and ran the config **headless on real neovim 0.12.2**: clean startup (zero errors/warnings), treesitter highlight attaches on a `.nix` file (non-bundled grammar → `withAllGrammars` works), none-ls loads and `deadnix` runs. The shared `development` module is also built on the 25.11 dev VM (under `fw`); the new textobjects config safely no-ops there (the old plugin lacks the new module path). That VM is being upgraded to 26.05 anyway.
NixOS 26.05 ships the nvim-treesitter "main"-branch rewrite on neovim
0.12.2, which removed the nvim-treesitter.configs module. The startup call
`require('nvim-treesitter.configs').setup{}` aborted the whole concatenated
lua chunk, so treesitter, textobjects, none-ls, bufferline, which-key and
sops all silently failed to load.

- treesitter.lua: highlight via native vim.treesitter.start() in a FileType
  autocmd. Drop dead module keys (rainbow is handled by rainbow-delimiters,
  autotag/context_commentstring plugins were never installed) and
  incremental_selection (removed upstream with no drop-in replacement).
- treesitter-textobjects.lua: rewrite to the new select API and add the
  nvim-treesitter-textobjects plugin in default.nix -- it was never in the
  plugin list, so af/if/ac/ic never actually worked before.
- utils.lua: drop none-ls diagnostics.eslint (builtin removed upstream;
  it errored with "failed to load builtin eslint").
- project.lua: use_lsp/ignore_lsp -> nested lsp = { enabled, ignore }.
- init.lua: vim.lsp.get_active_clients() -> get_clients({bufnr}); fix the
  broken client.detach() to buf_detach_client().
- which-key.lua / bufferline.lua: nvim_buf_get_option -> vim.bo[] accessor.
- default.nix: add alejandra/deadnix/statix/cppcheck so the configured
  none-ls sources actually run instead of warning "not executable".

Verified by building the full plugin set on nixos-26.05 and running the
config headless on neovim 0.12.2: clean startup (zero errors/warnings),
treesitter highlight attaches on a .nix file, none-ls + deadnix run.
Author
Owner

This was generated by AI while landing a PR.

Validated and merged via /land-pr (merge commit, at the author's explicit request).

Checked: Conventional Commits title ✓, no secrets.yaml / stateVersion touched ✓, diff scoped to utils/modules/development/nvim/ ✓, no conflict ✓. The repo's pre-commit gate is eval-only and can't exercise nvim's customRC Lua, so I built the neovim wrapper and ran it headless on a 25.11 host.

One real finding, merged knowingly (not a build/deploy breaker): on 25.11 the old nvim-treesitter-textobjects plugin still resolves, so the new config/treesitter-textobjects.lua if not ok then return guard doesn't fire and textobjects.setup(...) hits a nil field — E5108: attempt to call field 'setup' (a nil value). Because the config is one concatenated lua << EOF chunk, that aborts everything after it (none-ls, bufferline, which-key, sops). Build / eval / nixos-rebuild switch are unaffected — only nvim runtime is degraded. Blast radius: only the fw dev VM (25.11) imports this module besides nb (26.05, where it works). Clears when fw reaches 26.05.

Follow-up guard if fixing sooner: if not ok or type(textobjects.setup) ~= "function" then return end.

> *This was generated by AI while landing a PR.* **Validated and merged via `/land-pr`** (merge commit, at the author's explicit request). Checked: Conventional Commits title ✓, no `secrets.yaml` / `stateVersion` touched ✓, diff scoped to `utils/modules/development/nvim/` ✓, no conflict ✓. The repo's pre-commit gate is eval-only and can't exercise nvim's `customRC` Lua, so I built the neovim wrapper and ran it headless on a 25.11 host. **One real finding, merged knowingly (not a build/deploy breaker):** on 25.11 the old `nvim-treesitter-textobjects` plugin still resolves, so the new `config/treesitter-textobjects.lua` `if not ok then return` guard doesn't fire and `textobjects.setup(...)` hits a nil field — `E5108: attempt to call field 'setup' (a nil value)`. Because the config is one concatenated `lua << EOF` chunk, that aborts everything after it (none-ls, bufferline, which-key, sops). **Build / eval / `nixos-rebuild switch` are unaffected** — only nvim runtime is degraded. Blast radius: only the `fw` `dev` VM (25.11) imports this module besides `nb` (26.05, where it works). Clears when `fw` reaches 26.05. Follow-up guard if fixing sooner: `if not ok or type(textobjects.setup) ~= "function" then return end`.
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Cloonar/nixos!126
No description provided.