Skip to content

Commit a94147f

Browse files
committed
Avoid notifying of failures for workspace builds.
- Notifications of failure aren't shown for project builds - Also standardizes based on approach of other extensions that use similar functionality in their UI elements Signed-off-by: Roland Grunberg <rgrunber@redhat.com>
1 parent 8e50fcb commit a94147f

1 file changed

Lines changed: 14 additions & 18 deletions

File tree

src/standardLanguageClient.ts

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -493,22 +493,22 @@ export class StandardLanguageClient {
493493

494494
return window.withProgress({ location: ProgressLocation.Window }, async p => {
495495
p.report({ message: 'Rebuilding projects...' });
496-
return new Promise(async (resolve, reject) => {
497-
const start = new Date().getTime();
496+
const start = new Date().getTime();
498497

499-
let res: CompileWorkspaceStatus;
500-
try {
501-
res = token ? await this.languageClient.sendRequest(BuildProjectRequest.type, params, token) :
502-
await this.languageClient.sendRequest(BuildProjectRequest.type, params);
503-
} catch (error) {
504-
if (error && error.code === -32800) { // Check if the request is cancelled.
505-
res = CompileWorkspaceStatus.cancelled;
506-
}
507-
reject(error);
498+
let res: CompileWorkspaceStatus;
499+
try {
500+
res = token ? await this.languageClient.sendRequest(BuildProjectRequest.type, params, token) :
501+
await this.languageClient.sendRequest(BuildProjectRequest.type, params);
502+
} catch (error) {
503+
if (error && error.code === -32800) { // Check if the request is cancelled.
504+
res = CompileWorkspaceStatus.cancelled;
508505
}
506+
throw error;
507+
}
509508

510-
const elapsed = new Date().getTime() - start;
511-
const humanVisibleDelay = elapsed < 1000 ? 1000 : 0;
509+
const elapsed = new Date().getTime() - start;
510+
const humanVisibleDelay = elapsed < 1000 ? 1000 : 0;
511+
return new Promise(async (resolve, reject) => {
512512
setTimeout(() => { // set a timeout so user would still see the message when build time is short
513513
resolve(res);
514514
}, humanVisibleDelay);
@@ -540,11 +540,7 @@ export class StandardLanguageClient {
540540
const humanVisibleDelay = elapsed < 1000 ? 1000 : 0;
541541
return new Promise((resolve, reject) => {
542542
setTimeout(() => { // set a timeout so user would still see the message when build time is short
543-
if (res === CompileWorkspaceStatus.succeed) {
544-
resolve(res);
545-
} else {
546-
reject(res);
547-
}
543+
resolve(res);
548544
}, humanVisibleDelay);
549545
});
550546
});

0 commit comments

Comments
 (0)