Add setting to show commit SHAs in tree - #8840
Open
James Miller (jameswilmiller) wants to merge 2 commits into
Open
Add setting to show commit SHAs in tree#8840James Miller (jameswilmiller) wants to merge 2 commits into
James Miller (jameswilmiller) wants to merge 2 commits into
Conversation
Author
|
@microsoft-github-policy-service agree |
Copilot started reviewing on behalf of
James Miller (jameswilmiller)
July 13, 2026 16:30
View session
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.
Suppressed comments (4)
src/view/treeNodes/commitNode.ts:51
- The description is computed once in the constructor, so toggling
showCommitShaInTreemay not update existingCommitNodeinstances even if the parent refreshes. To ensure the UI reflects the current setting, compute/updatedescriptioninsidegetTreeItem()(or recompute on refresh) rather than only in the constructor.
this.description = this._getDescription();
}
private _getDescription(): string | undefined {
const date = this.commit.commit.author?.date ? dateFromNow(this.commit.commit.author.date) : undefined;
if (!vscode.workspace.getConfiguration(PR_SETTINGS_NAMESPACE).get<boolean>(SHOW_COMMIT_SHA_IN_TREE, false)) {
return date;
}
const shortSha = this.commit.sha.substring(0, 7);
return date ? `${shortSha} · ${date}` : shortSha;
}
src/view/treeNodes/commitsCategoryNode.ts:48
- Use the standard capitalization 'SHA' instead of 'Sha' in the log message.
Logger.appendLine(`Commit Sha display setting has changed, refreshing Commits node`, PR_TREE);
package.nls.json:193
- This description string is missing a trailing period, which is inconsistent with nearby setting descriptions.
"githubPullRequests.showCommitShaInTree.description": "Shows the abbreviated commit SHA in the tree view",
src/view/treeNodes/commitNode.ts:41
- The leading underscore is typically redundant on
privatemethods in TypeScript and can be inconsistent with common conventions. Consider renaming togetDescription()(orcomputeDescription()) for clarity and consistency.
private _getDescription(): string | undefined {
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.
I wasn't sure whether community contributions were being accepted but I took the liberty of making the PR.
Summary:
Adds a new setting that displays abbreviated commit SHAs in the pull request commits tree.
When enabled, commit descriptions are shown in the following format:
49334c4 · 2 days ago
I went with this design decision because date will truncate before SHA which I believe is the more important
piece of information when reviewing the commits as a list. If you believe a different direction would be better feel free to comment.
The setting defaults to disabled, so the existing behaviour remains unchanged.
Changes:
Testing:
manually verified that:
No automated tests were added ( I wasn't sure whether this was required but I am happy to write some if needed ).
I have attached screenshots below,
Screenshots
Setting:

Disabled Setting:

Disabled Setting with no date:

Enabled Setting:

Enabled Setting with no date:

Fixes #8701