Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/commands/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -888,6 +888,11 @@ export async function modifyProject(
await api.actionQuery("UPDATE %Studio.Project SET LastModified = NOW() WHERE Name = ?", [project]).catch(() => {
// Swallow error because VS Code doesn't care about the timestamp
});
// "Re-open" the project to signal to the source control class that it should reconcile the server version
// with the version stored in the source control system. This effectively acts like OnAfterSave().
await new StudioActions().fireProjectUserAction(api, project, OtherStudioAction.OpenedDocument).catch(() => {
// The modification has already been completed so there's no point in showing this error
});
}
} catch (error) {
handleError(error, `Failed to modify project '${project}'.`);
Expand Down Expand Up @@ -1168,6 +1173,12 @@ export async function modifyProjectMetadata(nodeOrUri: NodeBase | vscode.Uri | u
project,
]);

// "Re-open" the project to signal to the source control class that it should reconcile the server version
// with the version stored in the source control system. This effectively acts like OnAfterSave().
await new StudioActions().fireProjectUserAction(api, project, OtherStudioAction.OpenedDocument).catch(() => {
// The modification has already been completed so there's no point in showing this error
});

// Refesh the explorer
projectsExplorerProvider.refresh();
} catch (error) {
Expand Down
9 changes: 5 additions & 4 deletions src/commands/studio.ts
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,8 @@ export class StudioActions {
this.api
.actionQuery(query, parameters)
.then(async (data) => {
if (action.save && action.id != "6" && !this.name.endsWith(".PRJ") && this.uri) {
const isPrj = this.name.toUpperCase().endsWith(".PRJ");
if (action.save && action.id != "6" && !isPrj && this.uri) {
// Save the requested documents.
// Ignore the save flag if this is a project or bulk import action.
const bitString: string = action.save.toString().padStart(3, "0");
Expand Down Expand Up @@ -354,14 +355,14 @@ export class StudioActions {
}
const actionToProcess: UserAction = data.result.content.pop();

if (actionToProcess.reload) {
if (actionToProcess.reload && !isPrj) {
await vscode.commands.executeCommand("workbench.action.files.revert", this.uri);
}

const attemptedEditLabel = getOtherStudioActionLabel(OtherStudioAction.AttemptedEdit);
if (afterUserAction && actionToProcess.errorText !== "") {
if (action.label === attemptedEditLabel) {
if (this.name.toUpperCase().endsWith(".PRJ")) {
if (isPrj) {
// Store the "answer" so the caller knows there was an error
this.projectEditAnswer = "-1";
} else if (this.uri) {
Expand All @@ -380,7 +381,7 @@ export class StudioActions {
// Only revert if we have a URI
await vscode.commands.executeCommand("workbench.action.files.revert", this.uri);
}
if (this.name.toUpperCase().endsWith(".PRJ")) {
if (isPrj) {
// Store the answer. No answer means "allow the edit".
this.projectEditAnswer = answer ?? "1";
}
Expand Down
Loading