@@ -14,7 +14,7 @@ import { asImageDataURI, EMPTY_IMAGE_URI, fromReviewUri, ReviewUriParams, toReso
1414import { groupBy } from '../../common/utils' ;
1515import { FolderRepositoryManager , SETTINGS_NAMESPACE } from '../../github/folderRepositoryManager' ;
1616import { IResolvedPullRequestModel , PullRequestModel } from '../../github/pullRequestModel' ;
17- import { GITHUB_FILE_SCHEME } from '../compareChangesTreeDataProvider' ;
17+ import { FILECHANGE_FILE_SCHEME , GITHUB_FILE_SCHEME } from '../compareChangesTreeDataProvider' ;
1818import { FileViewedDecorationProvider } from '../fileViewedDecorationProvider' ;
1919import { DecorationProvider } from '../treeDecorationProvider' ;
2020import { TreeNode , TreeNodeParent } from './treeNode' ;
@@ -75,7 +75,7 @@ export class RemoteFileChangeNode extends TreeNode implements vscode.TreeItem {
7575 | { light : string | vscode . Uri ; dark : string | vscode . Uri }
7676 | vscode . ThemeIcon ;
7777 public command : vscode . Command ;
78- public resourceUri : vscode . Uri ;
78+ public fileChangeResourceUri : vscode . Uri ;
7979 public contextValue : string ;
8080 public childrenDisposables : vscode . Disposable [ ] = [ ] ;
8181 private _viewed : ViewedState ;
@@ -92,15 +92,15 @@ export class RemoteFileChangeNode extends TreeNode implements vscode.TreeItem {
9292 ) {
9393 super ( ) ;
9494 const viewed = this . pullRequest . fileChangeViewedState [ fileName ] ?? ViewedState . UNVIEWED ;
95- this . contextValue = `filechange :${ GitChangeType [ status ] } :${ viewed === ViewedState . VIEWED ? 'viewed' : 'unviewed'
95+ this . contextValue = `${ FILECHANGE_FILE_SCHEME } :${ GitChangeType [ status ] } :${ viewed === ViewedState . VIEWED ? 'viewed' : 'unviewed'
9696 } `;
9797 this . label = path . basename ( fileName ) ;
9898 this . description = vscode . workspace . asRelativePath ( path . dirname ( fileName ) , false ) ;
9999 if ( this . description === '.' ) {
100100 this . description = '' ;
101101 }
102102 this . iconPath = vscode . ThemeIcon . File ;
103- this . resourceUri = toResourceUri ( vscode . Uri . parse ( this . blobUrl ) , pullRequest . number , fileName , status ) ;
103+ this . fileChangeResourceUri = toResourceUri ( vscode . Uri . parse ( this . blobUrl ) , pullRequest . number , fileName , status ) ;
104104 this . updateViewed ( viewed ) ;
105105 this . command = {
106106 command : 'pr.openFileOnGitHub' ,
@@ -120,16 +120,20 @@ export class RemoteFileChangeNode extends TreeNode implements vscode.TreeItem {
120120 this . accessibilityInformation = { label : `View diffs and comments for file ${ this . label } ` , role : 'link' } ;
121121 }
122122
123+ get resourceUri ( ) : vscode . Uri {
124+ return this . filePath . with ( { query : this . fileChangeResourceUri . query } ) ;
125+ }
126+
123127 updateViewed ( viewed : ViewedState ) {
124128 if ( this . _viewed === viewed ) {
125129 return ;
126130 }
127131
128132 this . _viewed = viewed ;
129- this . contextValue = `filechange :${ GitChangeType [ this . status ] } :${ viewed === ViewedState . VIEWED ? 'viewed' : 'unviewed'
133+ this . contextValue = `${ FILECHANGE_FILE_SCHEME } :${ GitChangeType [ this . status ] } :${ viewed === ViewedState . VIEWED ? 'viewed' : 'unviewed'
130134 } `;
131135 FileViewedDecorationProvider . updateFileViewedState (
132- this . resourceUri ,
136+ this . fileChangeResourceUri ,
133137 this . pullRequest . number ,
134138 this . fileName ,
135139 viewed ,
@@ -150,7 +154,7 @@ export class FileChangeNode extends TreeNode implements vscode.TreeItem {
150154 | vscode . Uri
151155 | { light : string | vscode . Uri ; dark : string | vscode . Uri }
152156 | vscode . ThemeIcon ;
153- public resourceUri : vscode . Uri ;
157+ public fileChangeResourceUri : vscode . Uri ;
154158 public parentSha : string ;
155159 public contextValue : string ;
156160 public command : vscode . Command ;
@@ -199,15 +203,15 @@ export class FileChangeNode extends TreeNode implements vscode.TreeItem {
199203 ) {
200204 super ( ) ;
201205 const viewed = this . pullRequest . fileChangeViewedState [ this . fileName ] ?? ViewedState . UNVIEWED ;
202- this . contextValue = `filechange :${ GitChangeType [ this . status ] } :${ viewed === ViewedState . VIEWED ? 'viewed' : 'unviewed'
206+ this . contextValue = `${ FILECHANGE_FILE_SCHEME } :${ GitChangeType [ this . status ] } :${ viewed === ViewedState . VIEWED ? 'viewed' : 'unviewed'
203207 } `;
204208 this . label = path . basename ( this . fileName ) ;
205209 this . iconPath = vscode . ThemeIcon . File ;
206210 this . opts = {
207211 preserveFocus : true ,
208212 } ;
209213 this . updateShowOptions ( ) ;
210- this . resourceUri = toResourceUri (
214+ this . fileChangeResourceUri = toResourceUri (
211215 vscode . Uri . file ( this . fileName ) ,
212216 this . pullRequest . number ,
213217 this . fileName ,
@@ -246,14 +250,14 @@ export class FileChangeNode extends TreeNode implements vscode.TreeItem {
246250 this . accessibilityInformation = { label : `View diffs and comments for file ${ this . label } ` , role : 'link' } ;
247251 }
248252
249- get description ( ) : string {
253+ get resourceUri ( ) : vscode . Uri {
254+ return this . filePath . with ( { query : this . fileChangeResourceUri . query } ) ;
255+ }
256+
257+ get description ( ) : string | true {
250258 const layout = vscode . workspace . getConfiguration ( SETTINGS_NAMESPACE ) . get < string > ( FILE_LIST_LAYOUT ) ;
251259 if ( layout === 'flat' ) {
252- let description = vscode . workspace . asRelativePath ( path . dirname ( this . fileName ) , false ) ;
253- if ( description === '.' ) {
254- description = '' ;
255- }
256- return description ;
260+ return true ;
257261 } else {
258262 return '' ;
259263 }
@@ -265,10 +269,10 @@ export class FileChangeNode extends TreeNode implements vscode.TreeItem {
265269 }
266270
267271 this . _viewed = viewed ;
268- this . contextValue = `filechange :${ GitChangeType [ this . status ] } :${ viewed === ViewedState . VIEWED ? 'viewed' : 'unviewed'
272+ this . contextValue = `${ FILECHANGE_FILE_SCHEME } :${ GitChangeType [ this . status ] } :${ viewed === ViewedState . VIEWED ? 'viewed' : 'unviewed'
269273 } `;
270274 FileViewedDecorationProvider . updateFileViewedState (
271- this . resourceUri ,
275+ this . fileChangeResourceUri ,
272276 this . pullRequest . number ,
273277 this . fileName ,
274278 viewed ,
@@ -281,7 +285,7 @@ export class FileChangeNode extends TreeNode implements vscode.TreeItem {
281285 const reviewThreadsForNode = ( reviewThreadsByFile [ this . fileName ] || [ ] ) . filter ( thread => ! thread . isOutdated ) ;
282286
283287 DecorationProvider . updateFileComments (
284- this . resourceUri ,
288+ this . fileChangeResourceUri ,
285289 this . pullRequest . number ,
286290 this . fileName ,
287291 reviewThreadsForNode . length > 0 ,
@@ -484,7 +488,7 @@ export class GitFileChangeNode extends FileChangeNode implements vscode.TreeItem
484488export class GitHubFileChangeNode extends TreeNode implements vscode . TreeItem {
485489 public description : string ;
486490 public iconPath : vscode . ThemeIcon ;
487- public resourceUri : vscode . Uri ;
491+ public fileChangeResourceUri : vscode . Uri ;
488492
489493 public command : vscode . Command ;
490494
@@ -499,7 +503,7 @@ export class GitHubFileChangeNode extends TreeNode implements vscode.TreeItem {
499503 super ( ) ;
500504 this . label = fileName ;
501505 this . iconPath = vscode . ThemeIcon . File ;
502- this . resourceUri = vscode . Uri . file ( fileName ) . with ( {
506+ this . fileChangeResourceUri = vscode . Uri . file ( fileName ) . with ( {
503507 scheme : GITHUB_FILE_SCHEME ,
504508 query : JSON . stringify ( { status, fileName } ) ,
505509 } ) ;
@@ -542,6 +546,10 @@ export class GitHubFileChangeNode extends TreeNode implements vscode.TreeItem {
542546 } ;
543547 }
544548
549+ get resourceUri ( ) : vscode . Uri {
550+ return vscode . Uri . file ( this . fileName ) . with ( { query : this . fileChangeResourceUri . query } ) ;
551+ }
552+
545553 getTreeItem ( ) {
546554 return this ;
547555 }
0 commit comments