Skip to content

Commit c02ca0d

Browse files
committed
Brett's comments
1 parent 838d6cc commit c02ca0d

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1417,7 +1417,7 @@
14171417
"default": true
14181418
},
14191419
"objectscript.refreshClassesOnSync": {
1420-
"description": "Automatically refresh classes after any save or change by compilation",
1420+
"description": "Controls whether the entire content of client-side classes is replaced with the server copy after synchronizing with the server. If `false`, only the contents of Storage definitions are replaced.",
14211421
"type": "boolean",
14221422
"default": false
14231423
},
@@ -1761,4 +1761,4 @@
17611761
"extensionDependencies": [
17621762
"intersystems-community.servermanager"
17631763
]
1764-
}
1764+
}

src/api/atelier.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export interface Document {
4141
cat: "RTN" | "CLS" | "CSP" | "OTH";
4242
status: string;
4343
enc: boolean;
44-
flags?: 0 | 1;
44+
flags: 0 | 1;
4545
content: string[] | Buffer;
4646
ext?: UserAction | UserAction[];
4747
}

src/commands/compile.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -129,13 +129,13 @@ export async function importFile(
129129
ignoreConflict
130130
);
131131
workspaceState.update(`${file.uniqueId}:mtime`, Number(new Date(data.result.ts + "Z")));
132-
if (data.result.flags !== undefined && !willCompile) {
132+
if (!willCompile && isClass(file.name) && data.result.content.length) {
133133
// In this case, the file must be a CLS and data.result.content must be the new Storage definitions
134134
// (with the rest of the class if flags === 1)
135-
const oldContent = new TextDecoder("utf-8").decode(await vscode.workspace.fs.readFile(file.uri));
135+
const oldContent = new TextDecoder().decode(await vscode.workspace.fs.readFile(file.uri));
136136
const oldContentArray = oldContent.split(/\r?\n/);
137137
const storage = Buffer.isBuffer(data.result.content)
138-
? new TextDecoder().decode(data.result.content).split(/\r?\n/g)
138+
? new TextDecoder().decode(data.result.content).split(/\r?\n/)
139139
: data.result.content;
140140
const newContentArray = updateStorage(oldContentArray, storage);
141141
if (oldContentArray.some((oldLine, index) => oldLine !== newContentArray[index])) {
@@ -240,9 +240,9 @@ export async function loadChanges(files: (CurrentTextFile | CurrentBinaryFile)[]
240240
content = (await api.getDoc(file.name, file.uri)).result.content;
241241
} else {
242242
// Insert/update the storage part of class definition.
243-
content = new TextDecoder("utf-8").decode(await vscode.workspace.fs.readFile(file.uri)).split(/\r?\n/g);
243+
content = new TextDecoder().decode(await vscode.workspace.fs.readFile(file.uri)).split(/\r?\n/);
244244
let storage = (await api.getDoc(file.name, file.uri, undefined, true)).result.content;
245-
storage = Buffer.isBuffer(storage) ? new TextDecoder().decode(storage).split(/\r?\n/g) : storage;
245+
storage = Buffer.isBuffer(storage) ? new TextDecoder().decode(storage).split(/\r?\n/) : storage;
246246
content = updateStorage(content, storage);
247247
}
248248
exportedUris.add(file.uri.toString()); // Set optimistically

0 commit comments

Comments
 (0)