From 98389fa69584aa7574ea142acfacf5e558a008b8 Mon Sep 17 00:00:00 2001 From: Alex Ross <38270282+alexr00@users.noreply.github.com> Date: Tue, 10 Feb 2026 10:13:45 +0100 Subject: [PATCH 1/2] Improve overview titles --- resources/icons/dark/issue_webview.svg | 4 +++ resources/icons/issue_webview.svg | 4 +++ src/github/issueOverview.ts | 36 +++++++++++++++++++------- src/github/pullRequestOverview.ts | 4 +-- 4 files changed, 36 insertions(+), 12 deletions(-) create mode 100644 resources/icons/dark/issue_webview.svg create mode 100644 resources/icons/issue_webview.svg diff --git a/resources/icons/dark/issue_webview.svg b/resources/icons/dark/issue_webview.svg new file mode 100644 index 0000000000..39f5281600 --- /dev/null +++ b/resources/icons/dark/issue_webview.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/resources/icons/issue_webview.svg b/resources/icons/issue_webview.svg new file mode 100644 index 0000000000..97b7e7f497 --- /dev/null +++ b/resources/icons/issue_webview.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/src/github/issueOverview.ts b/src/github/issueOverview.ts index 750b9130d7..41ed06c8b3 100644 --- a/src/github/issueOverview.ts +++ b/src/github/issueOverview.ts @@ -64,7 +64,7 @@ export class IssueOverviewPanel extends W if (panel) { panel._panel.reveal(activeColumn, true); } else { - const title = `Issue #${identity.number.toString()}`; + const title = `#${identity.number.toString()}`; panel = new IssueOverviewPanel( telemetry, extensionUri, @@ -108,6 +108,21 @@ export class IssueOverviewPanel extends W return this._panels.get(panelKey(owner, repo, number)); } + /** + * Build a short panel title: `# `. + * The item title is truncated to approximately `maxLength` characters on a + * word boundary and suffixed with "..." when it doesn't fit in full. + */ + protected buildPanelTitle(itemNumber: number, itemTitle: string, maxLength: number = 20): string { + let truncated = itemTitle; + if (itemTitle.length > maxLength) { + const lastSpace = itemTitle.lastIndexOf(' ', maxLength); + const cutOff = lastSpace > 0 ? lastSpace : maxLength; + truncated = itemTitle.substring(0, cutOff) + '...'; + } + return `#${itemNumber} ${truncated}`; + } + protected setPanelTitle(title: string): void { try { this._panel.title = title; @@ -125,10 +140,13 @@ export class IssueOverviewPanel extends W folderRepositoryManager: FolderRepositoryManager, private readonly type: string = IssueOverviewPanel.viewType, existingPanel?: vscode.WebviewPanel, - iconSubpath?: { + iconSubpath: { light: string, dark: string, - } + } = { + light: 'resources/icons/issue_webview.svg', + dark: 'resources/icons/dark/issue_webview.svg', + } ) { super(); this._folderRepositoryManager = folderRepositoryManager; @@ -144,12 +162,10 @@ export class IssueOverviewPanel extends W enableFindWidget: true })); - if (iconSubpath) { - this._panel.iconPath = { - dark: vscode.Uri.joinPath(_extensionUri, iconSubpath.dark), - light: vscode.Uri.joinPath(_extensionUri, iconSubpath.light) - }; - } + this._panel.iconPath = { + dark: vscode.Uri.joinPath(_extensionUri, iconSubpath.dark), + light: vscode.Uri.joinPath(_extensionUri, iconSubpath.light) + }; this._webview = this._panel.webview; super.initialize(); @@ -298,7 +314,7 @@ export class IssueOverviewPanel extends W } this._item = issue as TItem; - this.setPanelTitle(`Issue #${issueModel.number.toString()}`); + this.setPanelTitle(this.buildPanelTitle(issueModel.number, issueModel.title)); Logger.debug('pr.initialize', IssueOverviewPanel.ID); this._postMessage({ diff --git a/src/github/pullRequestOverview.ts b/src/github/pullRequestOverview.ts index 2b4f5f080f..dc424b7b59 100644 --- a/src/github/pullRequestOverview.ts +++ b/src/github/pullRequestOverview.ts @@ -91,7 +91,7 @@ export class PullRequestOverviewPanel extends IssueOverviewPanel Date: Wed, 11 Feb 2026 10:21:45 +0100 Subject: [PATCH 2/2] Fix tests --- src/test/github/pullRequestOverview.test.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/test/github/pullRequestOverview.test.ts b/src/test/github/pullRequestOverview.test.ts index d8f9653439..d0469014fa 100644 --- a/src/test/github/pullRequestOverview.test.ts +++ b/src/test/github/pullRequestOverview.test.ts @@ -89,7 +89,7 @@ describe('PullRequestOverview', function () { await PullRequestOverviewPanel.createOrShow(telemetry, EXTENSION_URI, pullRequestManager, identity, prModel); assert( - createWebviewPanel.calledWith(sinonMatch.string, 'Pull Request #1000', vscode.ViewColumn.One, { + createWebviewPanel.calledWith(sinonMatch.string, '#1000', vscode.ViewColumn.One, { enableScripts: true, retainContextWhenHidden: true, localResourceRoots: [vscode.Uri.joinPath(EXTENSION_URI, 'dist')], @@ -130,7 +130,7 @@ describe('PullRequestOverview', function () { const panel0 = PullRequestOverviewPanel.findPanel(identity0.owner, identity0.repo, identity0.number); assert.notStrictEqual(panel0, undefined); assert.strictEqual(createWebviewPanel.callCount, 1); - assert.strictEqual(panel0!.getCurrentTitle(), 'Pull Request #1000'); + assert.strictEqual(panel0!.getCurrentTitle(), '#1000 New feature'); // Opening the same PR again should reuse the existing panel await PullRequestOverviewPanel.createOrShow(telemetry, EXTENSION_URI, pullRequestManager, identity0, prModel0); @@ -185,8 +185,8 @@ describe('PullRequestOverview', function () { assert.notStrictEqual(panel1, undefined); assert.notStrictEqual(panel0, panel1); assert.strictEqual(createWebviewPanel.callCount, 2); - assert.strictEqual(panel0!.getCurrentTitle(), 'Pull Request #1000'); - assert.strictEqual(panel1!.getCurrentTitle(), 'Pull Request #2000'); + assert.strictEqual(panel0!.getCurrentTitle(), '#1000 New feature'); + assert.strictEqual(panel1!.getCurrentTitle(), '#2000 New feature'); }); }); });