Fix flags_without_count option behavior for empty symbols #136
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.
The
flags_without_count
option was not handling empty symbols correctly. Previously, flags with empty symbols were completely hidden regardless of the option value, but according to the intended behavior, they should show counts whenflags_without_count=false
(default).Fixed Behavior
Case 1: Non-empty symbol with count=1
flags_without_count: false
→ prints:"S1"
(symbol + count)flags_without_count: true
→ prints:"S"
(symbol only)Case 2: Empty symbol with count=1
flags_without_count: false
→ prints:"1"
(count only)flags_without_count: true
→ prints:""
(nothing)Case 3: Count is 0
""
regardless offlags_without_count
valueChanges Made
formatFlag()
function to properly handle empty symbols based on theflags_without_count
optionflags()
function to callformatFlag
even when symbols are empty (as long as count > 0)Example
With a configuration where
staged
andmodified
symbols are empty:Before: Empty symbols were always hidden
After with
flags_without_count: false
: Shows"2 1 … 3"
(counts for empty symbols, symbol+count for non-empty)After with
flags_without_count: true
: Shows"…"
(only non-empty symbols, no counts)This change enables users to have full control over flag display behavior, allowing all combinations of symbol presence and count visibility.
Fixes #133.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.