@@ -75,7 +75,7 @@ export class FileChangeNode extends TreeNode implements vscode.TreeItem {
7575 public command : vscode . Command ;
7676 public opts : vscode . TextDocumentShowOptions ;
7777
78- public checkboxState : { state : vscode . TreeItemCheckboxState ; tooltip ?: string ; accessibilityInformation : vscode . AccessibilityInformation } ;
78+ public checkboxState ? : { state : vscode . TreeItemCheckboxState ; tooltip ?: string ; accessibilityInformation : vscode . AccessibilityInformation } ;
7979
8080 get status ( ) : GitChangeType {
8181 return this . changeModel . status ;
@@ -155,13 +155,34 @@ export class FileChangeNode extends TreeNode implements vscode.TreeItem {
155155 }
156156 }
157157
158+ /**
159+ * Check if this file node is under a commit node in the tree hierarchy.
160+ * Files under commit nodes should not have checkboxes.
161+ */
162+ private isUnderCommitNode ( ) : boolean {
163+ let current = this . parent ;
164+ while ( current instanceof TreeNode ) {
165+ // CommitNode has contextValue set to 'commit'
166+ if ( ( current as vscode . TreeItem ) . contextValue === 'commit' ) {
167+ return true ;
168+ }
169+ current = current . parent ;
170+ }
171+ return false ;
172+ }
173+
158174 updateViewed ( viewed : ViewedState ) {
159175 this . changeModel . updateViewed ( viewed ) ;
160176 this . contextValue = `${ Schemes . FileChange } :${ GitChangeType [ this . changeModel . status ] } :${ viewed === ViewedState . VIEWED ? 'viewed' : 'unviewed'
161177 } `;
162- this . checkboxState = viewed === ViewedState . VIEWED ?
163- { state : vscode . TreeItemCheckboxState . Checked , tooltip : vscode . l10n . t ( 'Mark File as Unviewed' ) , accessibilityInformation : { label : vscode . l10n . t ( 'Mark file {0} as unviewed' , this . label ?? '' ) } } :
164- { state : vscode . TreeItemCheckboxState . Unchecked , tooltip : vscode . l10n . t ( 'Mark File as Viewed' ) , accessibilityInformation : { label : vscode . l10n . t ( 'Mark file {0} as viewed' , this . label ?? '' ) } } ;
178+ // Don't show checkboxes for files under commit nodes
179+ if ( ! this . isUnderCommitNode ( ) ) {
180+ this . checkboxState = viewed === ViewedState . VIEWED ?
181+ { state : vscode . TreeItemCheckboxState . Checked , tooltip : vscode . l10n . t ( 'Mark File as Unviewed' ) , accessibilityInformation : { label : vscode . l10n . t ( 'Mark file {0} as unviewed' , this . label ?? '' ) } } :
182+ { state : vscode . TreeItemCheckboxState . Unchecked , tooltip : vscode . l10n . t ( 'Mark File as Viewed' ) , accessibilityInformation : { label : vscode . l10n . t ( 'Mark file {0} as viewed' , this . label ?? '' ) } } ;
183+ } else {
184+ this . checkboxState = undefined ;
185+ }
165186 this . pullRequestManager . setFileViewedContext ( ) ;
166187 }
167188
0 commit comments