feat(neogit): use new neogit apis for highlight and repo root#133
Merged
barrettruth merged 1 commit intomainfrom Feb 25, 2026
Merged
feat(neogit): use new neogit apis for highlight and repo root#133barrettruth merged 1 commit intomainfrom
barrettruth merged 1 commit intomainfrom
Conversation
Problem: diffs.nvim blanked 18 Neogit highlight groups globally on attach and fell back to getcwd() plus a subprocess call for repo root detection, with no cache refresh when Neogit lazy-loads new hunks. Solution: adopt three APIs from Neogit PR #1897: - set vim.b.neogit_disable_hunk_highlight = true on attach instead of overriding 18 hl groups globally - read vim.b.neogit_git_dir for reliable repo root resolution - register User NeogitDiffLoaded per-buffer to refresh hunk cache Closes #128
barrettruth
added a commit
that referenced
this pull request
Feb 25, 2026
## Problem Regressions #119 and #120 showed the test suite had no coverage of the decoration provider cache pipeline, no end-to-end pipeline tests from buffer content to extmarks, and no Neogit-specific integration tests. ## Solution Adds three new spec files (28 new tests, 316 total): - `spec/decoration_provider_spec.lua` — indirect cache pipeline tests via `_test` table: `ensure_cache` population, content fingerprint guard, `pending_clear` semantics, BufWipeout cleanup - `spec/integration_spec.lua` — full pipeline: diff buffer → `attach` → extmarks; verifies `DiffsAdd`/`DiffsDelete` on correct lines, treesitter captures, multi-hunk coverage - `spec/neogit_integration_spec.lua` — `neogit_disable_hunk_highlight` behavior, NeogitStatus/NeogitDiffView attach and cache population, parser neogit filename patterns Depends on #133. Closes #122
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.
Problem
diffs.nvim was blanking 18 Neogit highlight groups globally on attach to prevent Neogit's
line_hl_groupfg from stomping treesitter syntax. It also fell back togetcwd()plus a subprocess call for repo root detection on Neogit buffers, and had no mechanism to refresh the hunk cache when Neogit lazy-loaded new diff sections.Solution
Adopts three APIs introduced in NeogitOrg/neogit#1897:
vim.b.neogit_disable_hunk_highlight = trueon the Neogit buffer at attach time. Neogit'sHunkLinerenderer skips all its own highlight logic when this is set, replacing the need to blank 18 hl groups globally and the associated ColorScheme re-application.vim.b.neogit_git_diringet_repo_root()as a reliable fallback between the existingb:git_dircheck and thegetcwd()subprocess path.User NeogitDiffLoadedautocmd on attach that callsM.refresh()when Neogit lazy-loads a new diff section, keeping the hunk cache in sync.Closes #128