fix: relaxed saveAll if no Internet connection

The previous logic has incorrectly bailed the save when there is no
Internet connection. The corrected logic disallows saving files if there
is no connection between the frontend and the backend.

Ref: cff2c956845e04d320231e8a924d1a47ad016af7
Closes #2079

Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
This commit is contained in:
Akos Kitta 2023-05-30 10:59:23 +02:00 committed by Akos Kitta
parent db0049d635
commit 4af488b05e

View File

@ -8,13 +8,10 @@ import {
TabBar,
Widget,
} from '@theia/core/lib/browser';
import {
ConnectionStatus,
ConnectionStatusService,
} from '@theia/core/lib/browser/connection-status-service';
import { nls } from '@theia/core/lib/common/nls';
import { MessageService } from '@theia/core/lib/common/message-service';
import { inject, injectable } from '@theia/core/shared/inversify';
import { ApplicationConnectionStatusContribution } from './connection-status-service';
import { ToolbarAwareTabBar } from './tab-bars';
@injectable()
@ -22,8 +19,8 @@ export class ApplicationShell extends TheiaApplicationShell {
@inject(MessageService)
private readonly messageService: MessageService;
@inject(ConnectionStatusService)
private readonly connectionStatusService: ConnectionStatusService;
@inject(ApplicationConnectionStatusContribution)
private readonly connectionStatusService: ApplicationConnectionStatusContribution;
override async addWidget(
widget: Widget,
@ -64,9 +61,8 @@ export class ApplicationShell extends TheiaApplicationShell {
}
override async saveAll(options?: SaveOptions): Promise<void> {
if (
this.connectionStatusService.currentStatus === ConnectionStatus.OFFLINE
) {
// When there is no connection between the IDE2 frontend and backend.
if (this.connectionStatusService.offlineStatus === 'backend') {
this.messageService.error(
nls.localize(
'theia/core/couldNotSave',