@@ -137,6 +137,19 @@ export class OpenEditorsProvider
137137 return this . _workspace_provider . get_workspace_root_for_file ( file_path )
138138 }
139139
140+ private _is_file_ignored ( file_path : string ) : boolean {
141+ if ( this . _workspace_provider . is_ignored_by_patterns ( file_path ) ) {
142+ return true
143+ }
144+ const workspace_root = this . _get_containing_workspace_root ( file_path )
145+ if ( workspace_root ) {
146+ return this . _workspace_provider . is_excluded (
147+ path . relative ( workspace_root , file_path )
148+ )
149+ }
150+ return false
151+ }
152+
140153 private _uncheck_ignored_files ( ) {
141154 const checked_files = this . get_checked_files ( )
142155
@@ -232,9 +245,12 @@ export class OpenEditorsProvider
232245 }
233246 getTreeItem ( element : FileItem ) : vscode . TreeItem {
234247 const key = element . resourceUri . fsPath
235- const checkbox_state = this . _is_no_context_mode
236- ? undefined
237- : ( this . _checked_items . get ( key ) ?? vscode . TreeItemCheckboxState . Unchecked )
248+ const is_ignored = this . _is_file_ignored ( key )
249+ const checkbox_state =
250+ this . _is_no_context_mode || is_ignored
251+ ? undefined
252+ : ( this . _checked_items . get ( key ) ??
253+ vscode . TreeItemCheckboxState . Unchecked )
238254
239255 element . checkboxState = checkbox_state
240256
@@ -245,7 +261,7 @@ export class OpenEditorsProvider
245261 let final_description = element . description || ''
246262
247263 const prefix_parts : string [ ] = [ ]
248- if ( token_count !== undefined ) {
264+ if ( token_count !== undefined && ! is_ignored ) {
249265 prefix_parts . push ( display_token_count ( token_count ) )
250266 }
251267 if ( element . range ) {
@@ -308,18 +324,15 @@ export class OpenEditorsProvider
308324 }
309325
310326 const file_name = path . basename ( file_path )
311-
312- if ( this . _workspace_provider . is_ignored_by_patterns ( file_path ) ) {
313- continue
314- }
327+ const is_ignored = this . _is_file_ignored ( file_path )
315328
316329 let checkbox_state = this . _checked_items . get ( file_path )
317330
318331 if ( checkbox_state === undefined ) {
319332 const is_checked_in_workspace =
320333 this . _is_file_checked_in_workspace ( file_path )
321334
322- if ( is_checked_in_workspace ) {
335+ if ( is_checked_in_workspace && ! is_ignored ) {
323336 checkbox_state = vscode . TreeItemCheckboxState . Checked
324337 } else {
325338 checkbox_state = vscode . TreeItemCheckboxState . Unchecked
@@ -343,20 +356,21 @@ export class OpenEditorsProvider
343356 }
344357
345358 const range = this . _workspace_provider . get_range ( file_path )
346- const tokens =
347- this . _workspace_provider . get_cached_token_count ( file_path ) ||
348- ( await this . _workspace_provider . calculate_file_tokens ( file_path ) )
359+ const tokens = is_ignored
360+ ? undefined
361+ : this . _workspace_provider . get_cached_token_count ( file_path ) ||
362+ ( await this . _workspace_provider . calculate_file_tokens ( file_path ) )
349363
350364 const item = new FileItem (
351365 file_name ,
352366 file_uri ,
353367 vscode . TreeItemCollapsibleState . None ,
354368 false ,
355- this . _is_no_context_mode ? undefined : checkbox_state ,
369+ this . _is_no_context_mode || is_ignored ? undefined : checkbox_state ,
356370 false ,
357371 true ,
358- tokens . total ,
359- tokens . shrink ,
372+ tokens ? .total ,
373+ tokens ? .shrink ,
360374 undefined ,
361375 undefined ,
362376 description ,
@@ -428,8 +442,7 @@ export class OpenEditorsProvider
428442 const file_path = uri . fsPath
429443
430444 if ( ! this . _is_file_in_any_workspace ( file_path ) ) continue
431-
432- if ( this . _workspace_provider . is_ignored_by_patterns ( file_path ) ) continue
445+ if ( this . _is_file_ignored ( file_path ) ) continue
433446
434447 this . _checked_items . set ( file_path , vscode . TreeItemCheckboxState . Checked )
435448
@@ -458,8 +471,7 @@ export class OpenEditorsProvider
458471
459472 for ( const file_path of file_paths ) {
460473 if ( ! fs . existsSync ( file_path ) ) continue
461-
462- if ( this . _workspace_provider . is_ignored_by_patterns ( file_path ) ) continue
474+ if ( this . _is_file_ignored ( file_path ) ) continue
463475
464476 this . _checked_items . set ( file_path , vscode . TreeItemCheckboxState . Checked )
465477
0 commit comments