Skip to content

Fix vim-illuminate errors by disabling treesitter provider#204

Closed
rikuson wants to merge 2 commits into
masterfrom
fix/vim-illuminate-treesitter-provider
Closed

Fix vim-illuminate errors by disabling treesitter provider#204
rikuson wants to merge 2 commits into
masterfrom
fix/vim-illuminate-treesitter-provider

Conversation

@rikuson

@rikuson rikuson commented May 10, 2026

Copy link
Copy Markdown
Owner

Summary

  • vim-illuminate's treesitter provider depends on the legacy nvim-treesitter API (master branch), but our config pins nvim-treesitter to the main branch rewrite. The provider failed to load and Lua's cached failure spammed loop or previous error loading module 'illuminate.providers.treesitter' on every callback.
  • Restrict vim-illuminate to the lsp and regex providers, and lazy-load on BufReadPost/BufNewFile.

Test plan

  • Open a buffer in Neovim and confirm no illuminate.providers.treesitter errors
  • Verify word-under-cursor highlighting still works (LSP-backed where available, regex elsewhere)

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@claude

claude Bot commented May 10, 2026

Copy link
Copy Markdown

Code Review

Overview

This PR fixes a recurring Lua error (loop or previous error loading module 'illuminate.providers.treesitter') caused by a version mismatch: vim-illuminate's treesitter provider relies on the legacy nvim-treesitter master-branch API, while the config pins nvim-treesitter to the rewritten main branch. The fix restricts illuminate to lsp and regex providers and adds lazy-loading.


Code Quality and Style

  • Minimal and focused — the change is exactly as large as it needs to be. Good scope discipline.
  • Consistent formatting — the expanded table syntax matches the style used elsewhere in init.lua.
  • Lazy-loading is correctBufReadPost + BufNewFile is the standard event pair for buffer-level plugins like illuminate. This avoids loading the plugin on startup unnecessarily.

Correctness

  • illuminate.configure({ providers = { "lsp", "regex" } }) is the correct API call to drop the broken treesitter provider.
  • The order { "lsp", "regex" } is sensible: LSP is preferred where available, regex is the fallback.
  • This silences the spam error while preserving the core feature (word-under-cursor highlighting).

Potential Issues / Risks

  • Regex fallback accuracy: For files without an active LSP (e.g., plain text, shell scripts, unsupported languages), illuminate will fall back to regex matching. This is less precise than treesitter — it may over-highlight or miss matches in edge cases. Not a blocker, but worth being aware of.
  • No lsp_fallback consideration: Some configure options like min_count_to_highlight or under_cursor could improve the experience but are out of scope for a bug-fix PR.
  • Future revisit: If nvim-treesitter's main branch stabilizes and restores a compatible API, the treesitter provider could be re-enabled. A comment noting this trade-off would help a future reader, but it's not required.

Security

No concerns.


Test Coverage

The manual test plan in the PR description is appropriate for a Neovim plugin change — automated testing of Neovim UI behavior is impractical. The two checklist items cover the failure case (no errors) and the success case (highlighting still works).


Summary

This is a clean, well-reasoned bug fix. The root cause is correctly identified and the solution is minimal and non-breaking. No changes needed — LGTM.

🤖 Generated with Claude Code

- nvim-ts-autotag: lazy-load on InsertEnter and depend on nvim-treesitter
  so the plugin sources after vim.treesitter is ready, preventing the
  cascading "loop or previous error loading module 'vim.treesitter'"
  failures when opening a buffer for the first time.
- mason-lspconfig: rename "oxc" to "oxlint" — "oxc" is not a valid
  lspconfig server name; the LSP is registered as "oxlint" (binary:
  oxc_language_server).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@rikuson rikuson closed this May 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant