Skip to content

Commit 0e6f266

Browse files
authored
Remove online status popup (#299)
1 parent 01bb328 commit 0e6f266

File tree

2 files changed

+9
-15
lines changed

2 files changed

+9
-15
lines changed

src/server/CfnExternal.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export class CfnExternal implements Configurables, Closeable {
6363
overrides.guardService ??
6464
new GuardService(core.documentManager, core.diagnosticCoordinator, core.syntaxTreeManager);
6565

66-
this.onlineStatus = overrides.onlineStatus ?? new OnlineStatus(core.clientMessage);
66+
this.onlineStatus = overrides.onlineStatus ?? new OnlineStatus();
6767
this.featureFlags = overrides.featureFlags ?? new FeatureFlagProvider(getFromGitHub);
6868
this.onlineFeatureGuard = overrides.onlineFeatureGuard ?? new OnlineFeatureGuard(core.awsCredentials);
6969
}

src/services/OnlineStatus.ts

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
import { lookup } from 'node:dns/promises';
2-
import { MessageType } from 'vscode-languageserver-protocol';
3-
import { ClientMessage } from '../telemetry/ClientMessage';
2+
import { LoggerFactory } from '../telemetry/LoggerFactory';
43
import { Closeable } from '../utils/Closeable';
54

5+
const logger = LoggerFactory.getLogger('OnlineStatus');
6+
67
export class OnlineStatus implements Closeable {
78
private _isOnline: boolean = false;
89
private notifiedOnce: boolean = false;
910
private readonly timeout: NodeJS.Timeout;
1011

11-
constructor(private readonly clientMessage: ClientMessage) {
12+
constructor() {
1213
void this.hasInternet();
1314

1415
this.timeout = setInterval(
@@ -26,21 +27,14 @@ export class OnlineStatus implements Closeable {
2627
} catch {
2728
this._isOnline = false;
2829
} finally {
29-
await this.notify();
30+
this.notify();
3031
}
3132
}
3233

33-
private async notify() {
34+
private notify() {
3435
if (!this.notifiedOnce && !this._isOnline) {
35-
try {
36-
await this.clientMessage.showMessageNotification(
37-
MessageType.Warning,
38-
'Internet connection lost. Some AWS CloudFormation features may not work properly.',
39-
);
40-
this.notifiedOnce = true;
41-
} catch {
42-
// Nothing to do here
43-
}
36+
logger.warn('Internet connection lost. Some AWS CloudFormation features may not work properly.');
37+
this.notifiedOnce = true;
4438
}
4539
}
4640

0 commit comments

Comments
 (0)