From 5ba17a9f59a511d5ecf6cc2f31ba82eaef02d654 Mon Sep 17 00:00:00 2001 From: Brett Saviano Date: Mon, 13 Jan 2025 07:02:19 -0500 Subject: [PATCH] small tweaks --- src/commands/compile.ts | 8 ++++---- src/commands/export.ts | 10 +++++++--- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/commands/compile.ts b/src/commands/compile.ts index 73fd698c..bbc8e47a 100644 --- a/src/commands/compile.ts +++ b/src/commands/compile.ts @@ -750,7 +750,7 @@ export async function importXMLFiles(): Promise { connectionUri = ( await vscode.window.showWorkspaceFolderPick({ ignoreFocusOut: true, - placeHolder: "Pick the workspace folder to get server connection information from", + placeHolder: "Pick a workspace folder. Server-side folders import from the local file system.", }) )?.uri; } @@ -773,9 +773,9 @@ export async function importXMLFiles(): Promise { return; } let defaultUri = vscode.workspace.getWorkspaceFolder(connectionUri)?.uri ?? connectionUri; - if (defaultUri.scheme != "file") { - // Need a default URI with file scheme or the open dialog - // will show the virtual files from the workspace folder + if (defaultUri.scheme == FILESYSTEM_SCHEMA) { + // Need a default URI without the isfs scheme or the open dialog + // will show the server-side files instead of local ones defaultUri = vscode.workspace.workspaceFile; if (defaultUri.scheme != "file") { vscode.window.showErrorMessage( diff --git a/src/commands/export.ts b/src/commands/export.ts index 23d5df70..5b44dd69 100644 --- a/src/commands/export.ts +++ b/src/commands/export.ts @@ -312,7 +312,7 @@ export async function exportDocumentsToXMLFile(): Promise { connectionUri = ( await vscode.window.showWorkspaceFolderPick({ ignoreFocusOut: true, - placeHolder: "Pick the workspace folder to get server connection information from", + placeHolder: "Pick a workspace folder. Server-side folders export to the local file system.", }) )?.uri; } @@ -335,8 +335,8 @@ export async function exportDocumentsToXMLFile(): Promise { return; } let defaultUri = vscode.workspace.getWorkspaceFolder(connectionUri)?.uri ?? connectionUri; - if (defaultUri.scheme != "file") { - // Need a default URI with file scheme or the save dialog + if (schemas.includes(defaultUri.scheme)) { + // Need a default URI without the isfs scheme or the save dialog // will show the virtual files from the workspace folder defaultUri = vscode.workspace.workspaceFile; if (defaultUri.scheme != "file") { @@ -349,6 +349,10 @@ export async function exportDocumentsToXMLFile(): Promise { // Remove the file name from the URI defaultUri = defaultUri.with({ path: defaultUri.path.split("/").slice(0, -1).join("/") }); } + if (!vscode.workspace.fs.isWritableFileSystem(defaultUri.scheme)) { + vscode.window.showErrorMessage(`Cannot export to read-only file system '${defaultUri.scheme}'.`, "Dismiss"); + return; + } // Prompt the user for the documents to export const documents = await pickDocuments(api, "to export"); if (documents.length == 0) {