Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Oct 9, 2025

  • Reverted description-based approach as requested
  • Added CommitsNode scheme to URI types
  • Created helper functions for CommitsNode URI
  • Added resourceUri to CommitsNode
  • Created CommitsDecorationProvider
  • Registered CommitsDecorationProvider in extension.ts
  • Build and lint checks pass
  • Replied to first comment with implementation details
  • Added owner and repo to CommitsNodeUriParams
  • Use Schemes.CommitsNode constant in URI parsing
  • Listen for timeline changes to update commit count decoration
Original prompt

This section details on the original issue you should resolve

<issue_title>Show the pull request commit count somewhere</issue_title>
<issue_description>

I'd love to be able to see the commit count somewhere in the tree, status bar, or both. I often interactively rebase all pull request commits and need to know the count so I can do something like: git rebase -i HEAD~<count>.</issue_description>

<agent_instructions>Show the commit count as a decoration on the "Commits" tree element of the PullRequestChangesTreeDataProvider.</agent_instructions>

Comments on the Issue (you are @copilot in this section)

Fixes #5150

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] Show commit count in pull request tree Show commit count as decoration on Commits tree node Oct 9, 2025
Copilot AI requested a review from alexr00 October 9, 2025 08:34
Copilot finished work on behalf of alexr00 October 9, 2025 08:34
@andyshinn
Copy link

Cool! I could try it out if there was a way for me to build or pull down a pre-built VS Code to test. Is that a thing that exists?

Copy link
Member

@alexr00 alexr00 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@andyshinn, not really. But, once the PR is merged then the next day you'll be able to try it out in the pre-release version of the GitHub Pull Request extension.

Copy link
Member

@alexr00 alexr00 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot, don't use the description of the tree node. Instead use a file decoration.

Copy link
Contributor Author

Copilot AI commented Oct 10, 2025

@copilot, don't use the description of the tree node. Instead use a file decoration.

Done in 861832d. Changed to use a file decoration with badge showing the commit count instead of using the tree node's description property.

The implementation:

  • Added a new CommitsNode scheme to the URI system
  • Created CommitsDecorationProvider that provides file decorations for the Commits node
  • Set resourceUri on the CommitsNode so it receives the decoration
  • The badge displays the commit count (e.g., "5") with a tooltip showing "{count} commits"

The decoration will appear as a badge next to the "Commits" label in the tree view, similar to how other decorations work in VS Code (e.g., file status badges).

Copilot AI requested a review from alexr00 October 10, 2025 12:38
Copilot finished work on behalf of alexr00 October 10, 2025 12:38
Comment on lines 523 to 526
export interface CommitsNodeUriParams {
prNumber: number;
commitsCount: number;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot Should also include the owner and repo in the params

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in eaaa39d. Added owner and repo to CommitsNodeUriParams and updated the createCommitsNodeUri function to accept these parameters.

commitsCount
};

return vscode.Uri.parse(`commitsnode:${prNumber}`).with({
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot use Schemes.CommitsNode instead of using the string directly.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in eaaa39d. Changed to use Schemes.CommitsNode instead of the string literal 'commitsnode'.


registerPullRequestPropertyChangedListeners(_folderManager: FolderRepositoryManager, _model: PullRequestModel): vscode.Disposable {
// No need to listen for changes since commit count doesn't change dynamically
return { dispose: () => { } };
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot this can change, when for example the pr timeline changes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in eaaa39d. Updated to listen for onDidChange events with timeline: true and fire decoration updates when the PR timeline changes, which includes new commits being added.

Copilot AI requested a review from alexr00 October 16, 2025 16:32
Copilot finished work on behalf of alexr00 October 16, 2025 16:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Show the pull request commit count somewhere

3 participants