@@ -297,30 +297,45 @@ export class PRNode extends TreeNode implements vscode.CommentingRangeProvider2
297297 }
298298 }
299299
300- async getTreeItem ( ) : Promise < vscode . TreeItem > {
300+ private _getLabel ( ) : string {
301301 const currentBranchIsForThisPR = this . pullRequestModel . equals ( this . _folderReposManager . activePullRequest ) ;
302+ const { title, number, author, isDraft } = this . pullRequestModel ;
303+ let label = '' ;
302304
303- const { title, number, author, isDraft, html_url } = this . pullRequestModel ;
304- let labelTitle = this . pullRequestModel . title . length > 50 ? `${ this . pullRequestModel . title . substring ( 0 , 50 ) } ...` : this . pullRequestModel . title ;
305- if ( COPILOT_ACCOUNTS [ this . pullRequestModel . author . login ] ) {
306- labelTitle = labelTitle . replace ( '[WIP]' , '' ) ;
305+ if ( currentBranchIsForThisPR ) {
306+ label += '$(check) ' ;
307307 }
308- const login = author . specialDisplayName ?? author . login ;
309-
310- const hasNotification = this . _notificationProvider . hasNotification ( this . pullRequestModel ) || this . _prsTreeModel . hasCopilotNotification ( this . pullRequestModel . remote . owner , this . pullRequestModel . remote . repositoryName , this . pullRequestModel . number ) ;
311-
312- const formattedPRNumber = number . toString ( ) ;
313- let labelPrefix = currentBranchIsForThisPR ? '✓ ' : '' ;
314308
315309 if (
316310 vscode . workspace
317311 . getConfiguration ( PR_SETTINGS_NAMESPACE )
318312 . get < boolean > ( SHOW_PULL_REQUEST_NUMBER_IN_TREE , false )
319313 ) {
320- labelPrefix += `#${ formattedPRNumber } : ` ;
314+ label += `#${ number } : ` ;
315+ }
316+
317+ let labelTitle = title . length > 50 ? `${ title . substring ( 0 , 50 ) } ...` : title ;
318+ if ( COPILOT_ACCOUNTS [ author . login ] ) {
319+ labelTitle = labelTitle . replace ( '[WIP]' , '' ) ;
321320 }
321+ // Escape any $ in the title to avoid rendering PR titles as icons.
322+ label += labelTitle . replace ( / [ $ ] / g, '\\$' ) ;
322323
323- const label = `${ labelPrefix } ${ isDraft ? '\u270E ' : '' } ${ labelTitle } ` ;
324+ if ( isDraft ) {
325+ label = `_${ label } _` ;
326+ }
327+
328+ return label ;
329+ }
330+
331+ async getTreeItem ( ) : Promise < vscode . TreeItem > {
332+ const currentBranchIsForThisPR = this . pullRequestModel . equals ( this . _folderReposManager . activePullRequest ) ;
333+ const { title, number, author, isDraft, html_url } = this . pullRequestModel ;
334+ const login = author . specialDisplayName ?? author . login ;
335+ const hasNotification = this . _notificationProvider . hasNotification ( this . pullRequestModel ) || this . _prsTreeModel . hasCopilotNotification ( this . pullRequestModel . remote . owner , this . pullRequestModel . remote . repositoryName , this . pullRequestModel . number ) ;
336+ const label : vscode . TreeItemLabel2 = {
337+ label : new vscode . MarkdownString ( this . _getLabel ( ) , true )
338+ } ;
324339 const description = `by @${ login } ` ;
325340 const command = {
326341 title : vscode . l10n . t ( 'View Pull Request Description' ) ,
@@ -329,7 +344,7 @@ export class PRNode extends TreeNode implements vscode.CommentingRangeProvider2
329344 } ;
330345
331346 return {
332- label,
347+ label : label as vscode . TreeItemLabel ,
333348 id : `${ this . parent instanceof TreeNode ? ( this . parent . id ?? this . parent . label ) : '' } ${ html_url } ${ this . _isLocal ? this . pullRequestModel . localBranchName : '' } ` , // unique id stable across checkout status
334349 description,
335350 collapsibleState : 1 ,
@@ -341,7 +356,7 @@ export class PRNode extends TreeNode implements vscode.CommentingRangeProvider2
341356 ( ( ( this . pullRequestModel . item . isRemoteHeadDeleted && ! this . _isLocal ) || ! this . _folderReposManager . isPullRequestAssociatedWithOpenRepository ( this . pullRequestModel ) ) ? '' : ':hasHeadRef' ) ,
342357 iconPath : await this . _getIcon ( ) ,
343358 accessibilityInformation : {
344- label : `${ isDraft ? 'Draft ' : '' } Pull request number ${ formattedPRNumber } : ${ title } by ${ login } `
359+ label : `${ isDraft ? 'Draft ' : '' } Pull request number ${ number } : ${ title } by ${ login } `
345360 } ,
346361 resourceUri : createPRNodeUri ( this . pullRequestModel , this . parent instanceof CategoryTreeNode && this . parent . isCopilot ? true : undefined ) ,
347362 command
0 commit comments