@@ -120,55 +120,13 @@ function condense_paths(
120120 condensed_paths . add ( dir )
121121
122122 for ( const p of Array . from ( condensed_paths ) ) {
123- if ( p !== dir && p . startsWith ( dir + path . sep ) ) {
123+ if ( p != dir && p . startsWith ( dir + path . sep ) ) {
124124 condensed_paths . delete ( p )
125125 }
126126 }
127127 }
128128 }
129129
130- directories . sort (
131- ( a , b ) => a . split ( path . sep ) . length - b . split ( path . sep ) . length
132- )
133-
134- for ( const dir of directories ) {
135- if ( dir == '.' ) continue
136-
137- const parent_dir = path . dirname ( dir )
138- if ( parent_dir != '.' ) {
139- const parent_children = fs
140- . readdirSync ( path . join ( workspace_root , parent_dir ) )
141- . map ( ( child ) => path . join ( parent_dir , child ) )
142- . filter ( ( child_path ) => {
143- const abs_child_path = path . join ( workspace_root , child_path )
144- // IMPORTANT: Use the current workspace root for this file
145- const current_workspace_root =
146- workspace_provider . get_workspace_root_for_file ( abs_child_path ) ||
147- workspace_root
148- const relative_child_path = path . relative (
149- current_workspace_root ,
150- abs_child_path
151- )
152- return (
153- fs . existsSync ( abs_child_path ) &&
154- fs . lstatSync ( abs_child_path ) . isDirectory ( ) &&
155- ! workspace_provider . is_excluded ( relative_child_path )
156- )
157- } )
158-
159- const all_subdirs_selected = parent_children . every ( ( child ) =>
160- condensed_paths . has ( child )
161- )
162-
163- if ( all_subdirs_selected && parent_children . length > 0 ) {
164- for ( const child of parent_children ) {
165- condensed_paths . delete ( child )
166- }
167- condensed_paths . add ( parent_dir )
168- }
169- }
170- }
171-
172130 return Array . from ( condensed_paths )
173131}
174132
@@ -198,26 +156,26 @@ function add_workspace_prefix(
198156function group_files_by_workspace (
199157 checked_files : string [ ]
200158) : Map < string , string [ ] > {
201- const workspaceFolders = vscode . workspace . workspaceFolders || [ ]
202- const filesByWorkspace = new Map < string , string [ ] > ( )
159+ const workspace_folders = vscode . workspace . workspaceFolders || [ ]
160+ const files_by_workspace = new Map < string , string [ ] > ( )
203161
204- workspaceFolders . forEach ( ( folder ) => {
205- filesByWorkspace . set ( folder . uri . fsPath , [ ] )
162+ workspace_folders . forEach ( ( folder ) => {
163+ files_by_workspace . set ( folder . uri . fsPath , [ ] )
206164 } )
207165
208166 for ( const file of checked_files ) {
209- const workspace = workspaceFolders . find ( ( folder ) =>
167+ const workspace = workspace_folders . find ( ( folder ) =>
210168 file . startsWith ( folder . uri . fsPath )
211169 )
212170
213171 if ( workspace ) {
214- const files = filesByWorkspace . get ( workspace . uri . fsPath ) || [ ]
172+ const files = files_by_workspace . get ( workspace . uri . fsPath ) || [ ]
215173 files . push ( file )
216- filesByWorkspace . set ( workspace . uri . fsPath , files )
174+ files_by_workspace . set ( workspace . uri . fsPath , files )
217175 }
218176 }
219177
220- return filesByWorkspace
178+ return files_by_workspace
221179}
222180
223181export function save_context_command (
@@ -278,9 +236,7 @@ export function save_context_command(
278236 } )
279237 }
280238
281- all_prefixed_paths = all_prefixed_paths . map ( ( p ) =>
282- p . replace ( / \\ / g, '/' )
283- )
239+ all_prefixed_paths = all_prefixed_paths . map ( ( p ) => p . replace ( / \\ / g, '/' ) )
284240
285241 all_prefixed_paths . sort ( ( a , b ) => {
286242 const workspace_folders = vscode . workspace . workspaceFolders
0 commit comments