fix(parser): emit hunks for files with unknown filetypes#68
Merged
barrettruth merged 1 commit intomainfrom Feb 5, 2026
Merged
Conversation
Previously, hunks were discarded entirely if vim.filetype.match() returned nil. This meant files with unrecognized extensions got no highlighting at all - not even the basic green/red backgrounds for added/deleted lines. Remove the (current_lang or current_ft) condition from flush_hunk() so all hunks are collected. highlight_hunk() already handles the case where ft/lang are nil by skipping syntax highlighting but still applying background colors. Co-authored-by: phanen <phanen@qq.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.
Files with unrecognized extensions (no filetype detection) were receiving no highlighting at all in fugitive status - not even the basic green/red background colors for added/deleted lines.
The issue was in
flush_hunk()which required(current_lang or current_ft)to be truthy before emitting a hunk. This meant unknown filetypes were silently discarded.highlight_hunk()already handles nil ft/lang gracefully - it skips syntax highlighting but still appliesDiffsAdd/DiffsDeletebackgrounds. This fix lets those hunks through.Closes #62
Thanks to @phanen for identifying this issue and drafting the fix.