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
14 changes: 12 additions & 2 deletions src/commands/compile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,16 @@ function updateOthers(others: string[], baseUri: vscode.Uri) {
});
}

export async function loadChanges(files: (CurrentTextFile | CurrentBinaryFile)[]): Promise<any> {
/**
* Pull changes due to save/compile from server and write them into the local file.
* Also used to refresh the local copy from the server outside of the save/compile workflow.
* Pass `forceRefreshClasses` to replace the entire text of classes regardless of the
* value of the `objectscript.refreshClassesOnSync` setting.
*/
export async function loadChanges(
files: (CurrentTextFile | CurrentBinaryFile)[],
forceRefreshClasses = false
): Promise<any> {
if (!files.length) {
return;
}
Expand All @@ -236,7 +245,8 @@ export async function loadChanges(files: (CurrentTextFile | CurrentBinaryFile)[]
if (
!(
isClass(file.uri.path) &&
!vscode.workspace.getConfiguration("objectscript", file.uri).get("refreshClassesOnSync")
!vscode.workspace.getConfiguration("objectscript", file.uri).get("refreshClassesOnSync") &&
!forceRefreshClasses
)
) {
content = (await api.getDoc(file.name, file.uri)).result.content;
Expand Down
2 changes: 1 addition & 1 deletion src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1142,7 +1142,7 @@ export async function activate(context: vscode.ExtensionContext): Promise<any> {
const file = currentFile();
if (!file) return;
try {
await loadChanges([file]);
await loadChanges([file], true);
} catch (error) {
handleError(
error,
Expand Down
4 changes: 2 additions & 2 deletions src/providers/LowCodeEditorProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ export class LowCodeEditorProvider implements vscode.CustomTextEditorProvider {
});
} else if (isClientSide) {
// Load changes
loadChanges([file]);
loadChanges([file], true);
}
return;
case "compiled":
Expand All @@ -253,7 +253,7 @@ export class LowCodeEditorProvider implements vscode.CustomTextEditorProvider {
vscode.commands.executeCommand("workbench.action.files.revert");
}
// Load changes
if (isClientSide) loadChanges([file]);
if (isClientSide) loadChanges([file], true);
return;
case "userAction": {
// Process the source control user action
Expand Down
Loading