From 66ec793e9d1fa76fc15105f1019da35dd0172d2a Mon Sep 17 00:00:00 2001 From: Scott Dover Date: Fri, 15 Nov 2024 09:43:14 -0500 Subject: [PATCH] fix: fix rename issues Signed-off-by: Scott Dover --- .../ContentNavigator/ContentDataProvider.ts | 22 ++++++++++++------- .../connection/rest/RestSASServerAdapter.ts | 21 +++++++++++------- 2 files changed, 27 insertions(+), 16 deletions(-) diff --git a/client/src/components/ContentNavigator/ContentDataProvider.ts b/client/src/components/ContentNavigator/ContentDataProvider.ts index 5c525af6e..6cbb6bf94 100644 --- a/client/src/components/ContentNavigator/ContentDataProvider.ts +++ b/client/src/components/ContentNavigator/ContentDataProvider.ts @@ -301,15 +301,21 @@ class ContentDataProvider const oldUriToNewUriMap = [[item.vscUri, newUri]]; const newItemIsContainer = getIsContainer(newItem); if (closing !== true && !newItemIsContainer) { - commands.executeCommand("vscode.open", newUri); + await commands.executeCommand("vscode.open", newUri, "default", { + preview: false, + }); + } + if (closing !== true && newItemIsContainer) { + const urisToOpen = getPreviouslyOpenedChildItems( + await this.getChildren(newItem), + ); + for (const [, newUri] of urisToOpen) { + await commands.executeCommand("vscode.openWith", newUri, "default", { + preview: false, + }); + } + oldUriToNewUriMap.push(...urisToOpen); } - const urisToOpen = getPreviouslyOpenedChildItems( - await this.getChildren(newItem), - ); - urisToOpen.forEach(([, newUri]) => - commands.executeCommand("vscode.open", newUri), - ); - oldUriToNewUriMap.push(...urisToOpen); oldUriToNewUriMap.forEach(([uri, newUri]) => this._onDidManipulateFile.fire({ type: "rename", diff --git a/client/src/connection/rest/RestSASServerAdapter.ts b/client/src/connection/rest/RestSASServerAdapter.ts index fb672d774..f609988bd 100644 --- a/client/src/connection/rest/RestSASServerAdapter.ts +++ b/client/src/connection/rest/RestSASServerAdapter.ts @@ -383,16 +383,21 @@ class RestSASServerAdapter implements ContentAdapter { parsedFilePath.pop(); const path = parsedFilePath.join("/"); - const response = await this.fileSystemApi.updateFileOrDirectoryOnSystem({ - sessionId: this.sessionId, - fileOrDirectoryPath: filePath, - ifMatch: "", - fileProperties: { name: newName, path }, - }); + try { + const response = await this.fileSystemApi.updateFileOrDirectoryOnSystem({ + sessionId: this.sessionId, + fileOrDirectoryPath: filePath, + ifMatch: "", + fileProperties: { name: newName, path }, + }); - this.updateFileMetadata(filePath, response); + this.updateFileMetadata(filePath, response); - return this.filePropertiesToContentItem(response.data); + return this.filePropertiesToContentItem(response.data); + // eslint-disable-next-line @typescript-eslint/no-unused-vars + } catch (error) { + return; + } } public async updateContentOfItem(uri: Uri, content: string): Promise {