Skip to content

Commit 66ec793

Browse files
Scott DoverScott Dover
Scott Dover
authored and
Scott Dover
committed
fix: fix rename issues
Signed-off-by: Scott Dover <Scott.Dover@sas.com>
1 parent afad7aa commit 66ec793

File tree

2 files changed

+27
-16
lines changed

2 files changed

+27
-16
lines changed

client/src/components/ContentNavigator/ContentDataProvider.ts

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -301,15 +301,21 @@ class ContentDataProvider
301301
const oldUriToNewUriMap = [[item.vscUri, newUri]];
302302
const newItemIsContainer = getIsContainer(newItem);
303303
if (closing !== true && !newItemIsContainer) {
304-
commands.executeCommand("vscode.open", newUri);
304+
await commands.executeCommand("vscode.open", newUri, "default", {
305+
preview: false,
306+
});
307+
}
308+
if (closing !== true && newItemIsContainer) {
309+
const urisToOpen = getPreviouslyOpenedChildItems(
310+
await this.getChildren(newItem),
311+
);
312+
for (const [, newUri] of urisToOpen) {
313+
await commands.executeCommand("vscode.openWith", newUri, "default", {
314+
preview: false,
315+
});
316+
}
317+
oldUriToNewUriMap.push(...urisToOpen);
305318
}
306-
const urisToOpen = getPreviouslyOpenedChildItems(
307-
await this.getChildren(newItem),
308-
);
309-
urisToOpen.forEach(([, newUri]) =>
310-
commands.executeCommand("vscode.open", newUri),
311-
);
312-
oldUriToNewUriMap.push(...urisToOpen);
313319
oldUriToNewUriMap.forEach(([uri, newUri]) =>
314320
this._onDidManipulateFile.fire({
315321
type: "rename",

client/src/connection/rest/RestSASServerAdapter.ts

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -383,16 +383,21 @@ class RestSASServerAdapter implements ContentAdapter {
383383
parsedFilePath.pop();
384384
const path = parsedFilePath.join("/");
385385

386-
const response = await this.fileSystemApi.updateFileOrDirectoryOnSystem({
387-
sessionId: this.sessionId,
388-
fileOrDirectoryPath: filePath,
389-
ifMatch: "",
390-
fileProperties: { name: newName, path },
391-
});
386+
try {
387+
const response = await this.fileSystemApi.updateFileOrDirectoryOnSystem({
388+
sessionId: this.sessionId,
389+
fileOrDirectoryPath: filePath,
390+
ifMatch: "",
391+
fileProperties: { name: newName, path },
392+
});
392393

393-
this.updateFileMetadata(filePath, response);
394+
this.updateFileMetadata(filePath, response);
394395

395-
return this.filePropertiesToContentItem(response.data);
396+
return this.filePropertiesToContentItem(response.data);
397+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
398+
} catch (error) {
399+
return;
400+
}
396401
}
397402

398403
public async updateContentOfItem(uri: Uri, content: string): Promise<void> {

0 commit comments

Comments
 (0)