mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-09-06 08:18:39 +00:00
feat: add clipboard copy functionality to openImage for file paths
This commit is contained in:
parent
addd1bc6e7
commit
b10c87422a
1 changed files with 12 additions and 1 deletions
|
|
@ -16,10 +16,14 @@ export async function openImage(dataUriOrPath: string, options?: { values?: { ac
|
|||
if (fsPath.startsWith("/file/")) {
|
||||
fsPath = fsPath.slice("/file/".length)
|
||||
}
|
||||
|
||||
fsPath = path.normalize(fsPath)
|
||||
if (fsPath) {
|
||||
const fileUri = vscode.Uri.file(fsPath)
|
||||
if (options?.values?.action === "copy") {
|
||||
await vscode.env.clipboard.writeText(fsPath)
|
||||
vscode.window.showInformationMessage(t("common:info.path_copied_to_clipboard"))
|
||||
return
|
||||
}
|
||||
await vscode.commands.executeCommand("vscode.open", fileUri)
|
||||
return
|
||||
}
|
||||
|
|
@ -32,6 +36,13 @@ export async function openImage(dataUriOrPath: string, options?: { values?: { ac
|
|||
if (dataUriOrPath.startsWith("file://")) {
|
||||
try {
|
||||
const fileUri = vscode.Uri.parse(dataUriOrPath)
|
||||
const filePath = fileUri.fsPath
|
||||
|
||||
if (options?.values?.action === "copy") {
|
||||
await vscode.env.clipboard.writeText(filePath)
|
||||
vscode.window.showInformationMessage(t("common:info.path_copied_to_clipboard"))
|
||||
return
|
||||
}
|
||||
|
||||
await vscode.commands.executeCommand("vscode.open", fileUri)
|
||||
} catch (error) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue