@@ -2,10 +2,7 @@ import * as fs from 'fs'
22import * as path from 'path'
33import * as vscode from 'vscode'
44import ignore , { Ignore } from 'ignore'
5- import {
6- CONTEXT_SELECTED_PATHS_STATE_KEY ,
7- CONTEXT_SELECTED_TIMESTAMPS_STATE_KEY
8- } from '@/constants/state-keys'
5+ import { CONTEXT_SELECTED_PATHS_STATE_KEY } from '@/constants/state-keys'
96import { IGNORED_LOCK_FILES } from '@/constants/ignored-lock-files'
107import { natural_sort } from '@/utils/natural-sort'
118import { Logger } from '@shared/utils/logger'
@@ -25,10 +22,8 @@ export interface IWorkspaceProvider {
2522 get_checkbox_state ( path : string ) : vscode . TreeItemCheckboxState
2623 is_partially_selected ( path : string ) : boolean
2724 get_selected_files ( ) : string [ ]
28- get_selection_timestamp ( path : string ) : number | undefined
2925 get_export_state ( ) : {
3026 selected_files : string [ ]
31- selected_timestamps : Record < string , number >
3227 }
3328 get_all_files_for_uri ( uri : vscode . Uri ) : Promise < vscode . Uri [ ] >
3429 pause_file_watcher ( ) : void
@@ -53,7 +48,6 @@ export class WorkspaceProvider
5348 private _workspace_names : string [ ] = [ ]
5449
5550 private _checked_items = new Map < string , vscode . TreeItemCheckboxState > ( )
56- private _selected_timestamps = new Map < string , number > ( )
5751 private _partially_selected_dirs = new Set < string > ( )
5852
5953 private _combined_gitignore = ignore ( )
@@ -171,28 +165,18 @@ export class WorkspaceProvider
171165 CONTEXT_SELECTED_PATHS_STATE_KEY ,
172166 this . get_all_selected_paths ( )
173167 )
174- await this . _extension_context . workspaceState . update (
175- CONTEXT_SELECTED_TIMESTAMPS_STATE_KEY ,
176- Object . fromEntries ( this . _selected_timestamps )
177- )
178168 }
179169
180170 load_selected_files_state ( ) {
181171 const load = async ( ) => {
182172 const reg_paths = this . _extension_context . workspaceState . get < string [ ] > (
183173 CONTEXT_SELECTED_PATHS_STATE_KEY
184174 )
185- const reg_times = this . _extension_context . workspaceState . get <
186- Record < string , number >
187- > ( CONTEXT_SELECTED_TIMESTAMPS_STATE_KEY )
188175
189176 await this . gitignore_initialization
190177
191178 if ( reg_paths && reg_paths . length > 0 ) {
192- await this . set_selected_files (
193- reg_paths ,
194- reg_times ? new Map ( Object . entries ( reg_times ) ) : undefined
195- )
179+ await this . set_selected_files ( reg_paths )
196180 }
197181 }
198182 load ( )
@@ -202,15 +186,10 @@ export class WorkspaceProvider
202186 return {
203187 selected_files : Array . from ( this . _checked_items . entries ( ) )
204188 . filter ( ( [ , state ] ) => state === vscode . TreeItemCheckboxState . Checked )
205- . map ( ( [ path ] ) => path ) ,
206- selected_timestamps : Object . fromEntries ( this . _selected_timestamps )
189+ . map ( ( [ path ] ) => path )
207190 }
208191 }
209192
210- get_selection_timestamp ( path : string ) : number | undefined {
211- return this . _selected_timestamps . get ( path )
212- }
213-
214193 get_workspace_root_for_file ( file_path : string ) : string | undefined {
215194 if ( this . _file_workspace_map . has ( file_path ) ) {
216195 return this . _file_workspace_map . get ( file_path )
@@ -257,7 +236,6 @@ export class WorkspaceProvider
257236
258237 for ( const file_path of files_to_uncheck ) {
259238 this . _checked_items . set ( file_path , vscode . TreeItemCheckboxState . Unchecked )
260- this . _selected_timestamps . delete ( file_path )
261239
262240 let dir_path = path . dirname ( file_path )
263241 const workspace_root = this . get_workspace_root_for_file ( file_path )
@@ -450,7 +428,6 @@ export class WorkspaceProvider
450428 if ( ! fs . existsSync ( changed_file_path ) ) {
451429 this . _file_workspace_map . delete ( changed_file_path )
452430 this . _checked_items . delete ( changed_file_path )
453- this . _selected_timestamps . delete ( changed_file_path )
454431 this . _partially_selected_dirs . delete ( changed_file_path )
455432
456433 let parent_dir = path . dirname ( changed_file_path )
@@ -579,7 +556,6 @@ export class WorkspaceProvider
579556 } else {
580557 this . _file_workspace_map . delete ( file_path )
581558 this . _checked_items . delete ( file_path )
582- this . _selected_timestamps . delete ( file_path )
583559 this . _partially_selected_dirs . delete ( file_path )
584560 }
585561
@@ -602,7 +578,6 @@ export class WorkspaceProvider
602578
603579 async clear_selected_files ( ) : Promise < void > {
604580 this . _checked_items . clear ( )
605- this . _selected_timestamps . clear ( )
606581 this . _partially_selected_dirs . clear ( )
607582 this . _token_calculator . clear_selected_counts ( )
608583
@@ -1043,13 +1018,6 @@ export class WorkspaceProvider
10431018 }
10441019
10451020 this . _checked_items . set ( key , state )
1046- if ( state === vscode . TreeItemCheckboxState . Checked ) {
1047- if ( ! this . _selected_timestamps . has ( key ) ) {
1048- this . _selected_timestamps . set ( key , Math . floor ( Date . now ( ) / 1000 ) )
1049- }
1050- } else {
1051- this . _selected_timestamps . delete ( key )
1052- }
10531021 this . _token_calculator . invalidate_directory_selected_count ( key )
10541022
10551023 if ( item . isDirectory ) {
@@ -1240,16 +1208,6 @@ export class WorkspaceProvider
12401208 }
12411209
12421210 this . _checked_items . set ( full_path , state )
1243- if ( state === vscode . TreeItemCheckboxState . Checked ) {
1244- if ( ! this . _selected_timestamps . has ( full_path ) ) {
1245- this . _selected_timestamps . set (
1246- full_path ,
1247- Math . floor ( Date . now ( ) / 1000 )
1248- )
1249- }
1250- } else {
1251- this . _selected_timestamps . delete ( full_path )
1252- }
12531211
12541212 if ( entry . isDirectory ( ) ) {
12551213 await this . _update_directory_checkbox_state ( full_path , state , false )
@@ -1293,14 +1251,9 @@ export class WorkspaceProvider
12931251 . map ( ( [ path ] ) => path )
12941252 }
12951253
1296- async set_selected_files (
1297- file_paths : string [ ] ,
1298- timestamps ?: Map < string , number >
1299- ) : Promise < void > {
1254+ async set_selected_files ( file_paths : string [ ] ) : Promise < void > {
13001255 await this . gitignore_initialization
1301- const old_timestamps = new Map ( this . _selected_timestamps )
13021256 this . _checked_items . clear ( )
1303- this . _selected_timestamps . clear ( )
13041257 this . _partially_selected_dirs . clear ( )
13051258 this . _token_calculator . clear_selected_counts ( )
13061259
@@ -1345,12 +1298,6 @@ export class WorkspaceProvider
13451298
13461299 for ( const file_path of all_files_to_check ) {
13471300 this . _checked_items . set ( file_path , vscode . TreeItemCheckboxState . Checked )
1348-
1349- const timestamp =
1350- timestamps ?. get ( file_path ) ??
1351- old_timestamps . get ( file_path ) ??
1352- Math . floor ( Date . now ( ) / 1000 )
1353- this . _selected_timestamps . set ( file_path , timestamp )
13541301 }
13551302
13561303 for ( const file_path of [ ...file_paths , ...all_files_to_check ] ) {
0 commit comments