Skip to content

Commit aba70cf

Browse files
committed
Support multi-root workspace relative paths in response processor and remove unused clipboard path logging
- it's been reported that while `apps/editor/src/commands/select-clipboard-paths-command.ts` works correctly with multi-root folder workspaces, the 'apply response command' does not. Note that the `apps/editor/src/commands/select-clipboard-paths-command.ts` is more elastic than 'apply response command' has to be - if this is multi-root folder workspace, paths are ALWAYS prefixed. └── apps └── editor └── src ├── commands │ ├── apply-response-command │ │ ├── apply-response-command.ts │ │ ├── response-processor.ts │ │ └── utils │ │ └── response-parser │ │ ├── parsers │ │ │ └── relevant-files-parser │ │ │ ├── index.ts │ │ │ └── relevant-files-parser.ts │ │ └── response-parser.ts │ └── select-clipboard-paths-command.ts └── extension.ts
1 parent 7882437 commit aba70cf

2 files changed

Lines changed: 15 additions & 7 deletions

File tree

‎apps/editor/src/commands/apply-response-command/response-processor.ts‎

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,25 @@ export const process_response = async (params: {
129129
is_checked: boolean
130130
}[] = []
131131

132+
const is_multi_root = workspace_roots.length > 1
133+
132134
for (const rel_path of Array.from(all_paths_to_process)) {
133135
let absolute_path: string | undefined
134136
let matched_workspace_root: string | undefined
137+
135138
for (const root of workspace_roots) {
136-
const potential = path.join(root, rel_path)
139+
let potential_rel_path = rel_path
140+
141+
if (is_multi_root) {
142+
const workspace_name =
143+
params.workspace_provider.get_workspace_name(root)
144+
const prefix = `${workspace_name}/`
145+
if (rel_path.startsWith(prefix)) {
146+
potential_rel_path = rel_path.substring(prefix.length)
147+
}
148+
}
149+
150+
const potential = path.join(root, potential_rel_path)
137151
if (fs.existsSync(potential)) {
138152
absolute_path = potential
139153
matched_workspace_root = root

‎apps/editor/src/commands/select-clipboard-paths-command.ts‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -346,12 +346,6 @@ export const select_clipboard_paths_command = (
346346
}
347347

348348
if (has_updates) {
349-
const unique_final_selected = [...new Set(final_selected_paths)]
350-
Logger.info({
351-
message: `Selected ${unique_final_selected.length} clipboard paths.`,
352-
data: { paths: unique_final_selected }
353-
})
354-
355349
await workspace_provider.set_checked_files(accumulated_checked)
356350

357351
vscode.window.showInformationMessage(

0 commit comments

Comments
 (0)