feat(scm): Customizable SCM Graph History Item Formatting (GitLens-style Variable Support) #260232
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.
Overview
This PR implements customizable formatting for SCM Graph History items in VS Code #255719, allowing users to personalize how commit history is displayed in the Source Control Graph view. Inspired by GitLens, it introduces a configuration option for variable-based formatting, enabling greater flexibility and clarity for teams and individuals.
Key Changes
1. Configuration Setting
Added
"scm.graph.historyItemFormat"
tosrc/vs/workbench/contrib/scm/browser/scm.contribution.ts
:string
${author}
— Commit author name${authorEmail}
— Author email${subject}
— Commit subject/title${message}
— Full commit message${hash}
— Full commit hash${displayId}
— Shortened commit hash${date}
— Relative date (e.g., "2 hours ago")${timestamp}
— Full timestampExamples:
${subject}
${displayId} - ${subject}
${author} • ${subject}
[${displayId}] ${subject} by ${author}
${subject} (${date})
2. Formatting Function
Introduced
formatHistoryItem
insrc/vs/workbench/contrib/scm/browser/util.ts
:3. Renderer Integration
Updated
HistoryItemRenderer
insrc/vs/workbench/contrib/scm/browser/scmHistoryViewPane.ts
:"scm.graph.historyItemFormat"
using VS Code's observable pattern.autorun
for real-time UI updates when settings change.formatHistoryItem
.4. Comprehensive Testing
Added test coverage in
src/vs/workbench/contrib/scm/test/browser/util.test.ts
: