Skip to content

Commit 5fdb10d

Browse files
committed
load compiled source only when successed
1 parent fc9be1c commit 5fdb10d

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/commands/compile.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ function updateOthers(others: string[]) {
3535
}
3636

3737
async function loadChanges(files: CurrentFile[]): Promise<any> {
38+
if (!files.length) {
39+
return;
40+
}
3841
const api = new AtelierAPI(files[0].uri);
3942
return Promise.all(
4043
files.map(file =>
@@ -72,14 +75,15 @@ async function compile(docs: CurrentFile[], flags?: string): Promise<any> {
7275
}
7376
return docs;
7477
})
75-
.then(loadChanges)
7678
.catch((error: Error) => {
7779
outputChannel.appendLine(error.message);
7880
outputChannel.show(true);
7981
vscode.window.showErrorMessage(error.message, "Show details").then(data => {
8082
outputChannel.show(true);
8183
});
82-
});
84+
return [];
85+
})
86+
.then(loadChanges);
8387
}
8488

8589
export async function importAndCompile(askFLags = false): Promise<any> {

0 commit comments

Comments
 (0)