Skip to content

Commit

Permalink
fix: fix rename issues
Browse files Browse the repository at this point in the history
Signed-off-by: Scott Dover <[email protected]>
  • Loading branch information
Scott Dover authored and Scott Dover committed Nov 15, 2024
1 parent afad7aa commit 66ec793
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 16 deletions.
22 changes: 14 additions & 8 deletions client/src/components/ContentNavigator/ContentDataProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
21 changes: 13 additions & 8 deletions client/src/connection/rest/RestSASServerAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<void> {
Expand Down

0 comments on commit 66ec793

Please sign in to comment.