Skip to content

Commit 838d6cc

Browse files
committed
debug
1 parent ae3b955 commit 838d6cc

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/commands/compile.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,9 @@ 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 === 1 && !willCompile) {
133-
// If flags === 1, putDoc returns new Storage definitions and the file must be a CLS
132+
if (data.result.flags !== undefined && !willCompile) {
133+
// In this case, the file must be a CLS and data.result.content must be the new Storage definitions
134+
// (with the rest of the class if flags === 1)
134135
const oldContent = new TextDecoder("utf-8").decode(await vscode.workspace.fs.readFile(file.uri));
135136
const oldContentArray = oldContent.split(/\r?\n/);
136137
const storage = Buffer.isBuffer(data.result.content)

src/utils/documentIndex.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -263,14 +263,14 @@ export async function indexWorkspaceFolder(wsFolder: vscode.WorkspaceFolder): Pr
263263
if (change.addedOrChanged) {
264264
// Create or update the document on the server
265265
try {
266-
const willCompile = vscodeChange && vscode.window.activeTextEditor?.document.uri.toString() == uriString;
266+
const willCompile = conf.get("compileOnSave") && isCompilable(change.addedOrChanged.name);
267267
await importFile(change.addedOrChanged, willCompile);
268268
outputImport(change.addedOrChanged.name, uri);
269-
if (conf.get("compileOnSave") && isCompilable(change.addedOrChanged.name)) {
269+
if (willCompile) {
270270
// Compile right away if this document is in the active text editor.
271271
// This is needed to avoid noticeable latency when a user is editing
272272
// a client-side file, saves it, and the auto-compile kicks in.
273-
if (willCompile) {
273+
if (vscodeChange && vscode.window.activeTextEditor?.document.uri.toString() == uriString) {
274274
compile([change.addedOrChanged]);
275275
} else {
276276
debouncedCompile(change.addedOrChanged);

0 commit comments

Comments
 (0)