Skip to content

Commit 8190f73

Browse files
committed
(maint) Fix loading UI never leaving 0%
Previously the Loading Puppet 0% message would remain if the language server disabled preload. This commit fixes the problem by returning from the promise once the timeout is hit, stopping the next message request which is what was setting the 0%
1 parent 8bbe615 commit 8190f73

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

client/src/connection.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -281,18 +281,19 @@ export class ConnectionManager implements IConnectionManager {
281281
// After 30 seonds timeout the progress
282282
if (count >= 30 || connectionManager.languageClient == undefined) {
283283
clearInterval(handle);
284-
connectionManager.setConnectionStatus(lastVersionResponse.puppetVersion, ConnectionStatus.Running);
284+
this.setConnectionStatus(lastVersionResponse.puppetVersion, ConnectionStatus.Running);
285285
resolve();
286+
return;
286287
}
287288

288289
connectionManager.languageClient.sendRequest(messages.PuppetVersionRequest.type).then((versionDetails) => {
289290
lastVersionResponse = versionDetails
290-
if (versionDetails.factsLoaded &&
291+
if (!connectionManager.connectionConfiguration.preLoadPuppet || (versionDetails.factsLoaded &&
291292
versionDetails.functionsLoaded &&
292293
versionDetails.typesLoaded &&
293-
versionDetails.classesLoaded) {
294+
versionDetails.classesLoaded)) {
294295
clearInterval(handle);
295-
connectionManager.setConnectionStatus(lastVersionResponse.puppetVersion, ConnectionStatus.Running);
296+
this.setConnectionStatus(lastVersionResponse.puppetVersion, ConnectionStatus.Running);
296297
resolve();
297298
} else {
298299
let progress = 0;
@@ -358,6 +359,7 @@ export class ConnectionManager implements IConnectionManager {
358359
}
359360

360361
private setConnectionStatus(statusText: string, status: ConnectionStatus): void {
362+
console.log(statusText)
361363
// Set color and icon for 'Running' by default
362364
var statusIconText = "$(terminal) ";
363365
var statusColor = "#affc74";

0 commit comments

Comments
 (0)