Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add names to scm status bar items #168227

Merged
merged 1 commit into from
Dec 13, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 15 additions & 1 deletion src/vs/workbench/contrib/scm/browser/activity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,22 @@ export class SCMStatusController implements IWorkbenchContribution {
const command = commands[index];
const tooltip = `${label}${command.tooltip ? ` - ${command.tooltip}` : ''}`;

// Get a repository agnostic name for the status bar action, derive this from the
// first command argument which is in the form "git.<command>/<number>"
let repoAgnosticActionName = command.arguments?.[0];
if (repoAgnosticActionName && typeof repoAgnosticActionName === 'string') {
repoAgnosticActionName = repoAgnosticActionName
.substring(0, repoAgnosticActionName.lastIndexOf('/'))
.replace(/^git\./, '');
if (repoAgnosticActionName.length > 1) {
repoAgnosticActionName = repoAgnosticActionName[0].toLocaleUpperCase() + repoAgnosticActionName.slice(1);
}
} else {
repoAgnosticActionName = '';
}

disposables.add(this.statusbarService.addEntry({
name: localize('status.scm', "Source Control"),
name: localize('status.scm', "Source Control") + (repoAgnosticActionName ? ` ${repoAgnosticActionName}` : ''),
text: command.title,
ariaLabel: tooltip,
tooltip,
Expand Down