Repository navigation
Conversation
Parsers compile in the background at startup. Buffers that load before the compile finishes never pick the new language up: a .rs buffer keeps no highlighter, and a markdown buffer keeps its ```rust block parsed without Rust until the next edit or :edit. Install only the missing parsers and, once that task completes, reparse and restart highlighting in every loaded buffer whose filetype this config manages. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why the change
When a new treesitter parser compiles in the background at startup, buffers that are already open never pick it up, so this restarts their highlighting once the install finishes.
Special things to note
Change outline
Startup install step in the nvim-treesitter config (
dot_config/nvim/init.lua):Details
Summary
Treesitter parsers compile in the background at startup. Buffers that
load before a new parser finishes never pick it up. A
.rsbuffer getsno highlighter, and a markdown buffer's
```rustblock staysunhighlighted until the next edit or
:edit. This showed up on the firstlaunch after #201 added the
rustparser.Changes
Testing
In an isolated data dir with the Rust parser and queries removed, a
markdown buffer and a
.rsbuffer were open while the parser compiled.No edits or forced reloads afterwards:
.rshighlightermarkdown_inline, lua, typescriptrust, lua, markdown_inline, typescriptStartup with nothing to install (randomized A/B, n=80): master 55.8 ms
median, this PR 53.5 ms. The install module is no longer loaded when no
parser is missing.
get_installed()takes 0.17 ms.Gates:
pre-commit --all-files,tests/nvim/smoke.lua,tests/nvim/run_tests.lua, and both bats suites pass.🤖 Generated with Claude Code