mirror of
https://github.com/arduino/arduino-ide.git
synced 2025-07-08 11:56:36 +00:00
workaround for theia-ide/theia#7828
instead otf reloaading the current window, we open a new one and close the current. reloading the current window hangs on electron in Windows env. Signed-off-by: Akos Kitta <kittaakos@typefox.io>
This commit is contained in:
parent
bc4c3e04f5
commit
2e729fc29e
@ -1,12 +1,13 @@
|
|||||||
import { injectable, inject } from 'inversify';
|
import { injectable, inject } from 'inversify';
|
||||||
import URI from '@theia/core/lib/common/uri';
|
import URI from '@theia/core/lib/common/uri';
|
||||||
|
import { FileStat } from '@theia/filesystem/lib/common';
|
||||||
import { EditorWidget } from '@theia/editor/lib/browser';
|
import { EditorWidget } from '@theia/editor/lib/browser';
|
||||||
import { LabelProvider } from '@theia/core/lib/browser/label-provider';
|
import { LabelProvider } from '@theia/core/lib/browser/label-provider';
|
||||||
import { MessageService } from '@theia/core/lib/common/message-service';
|
import { MessageService } from '@theia/core/lib/common/message-service';
|
||||||
import { ApplicationServer } from '@theia/core/lib/common/application-protocol';
|
import { ApplicationServer } from '@theia/core/lib/common/application-protocol';
|
||||||
import { FrontendApplication } from '@theia/core/lib/browser/frontend-application';
|
import { FrontendApplication } from '@theia/core/lib/browser/frontend-application';
|
||||||
import { FocusTracker, Widget } from '@theia/core/lib/browser';
|
import { FocusTracker, Widget } from '@theia/core/lib/browser';
|
||||||
import { WorkspaceService as TheiaWorkspaceService } from '@theia/workspace/lib/browser/workspace-service';
|
import { WorkspaceService as TheiaWorkspaceService, WorkspaceInput } from '@theia/workspace/lib/browser/workspace-service';
|
||||||
import { ConfigService } from '../../../common/protocol/config-service';
|
import { ConfigService } from '../../../common/protocol/config-service';
|
||||||
import { SketchesService } from '../../../common/protocol/sketches-service';
|
import { SketchesService } from '../../../common/protocol/sketches-service';
|
||||||
import { ArduinoWorkspaceRootResolver } from '../../arduino-workspace-resolver';
|
import { ArduinoWorkspaceRootResolver } from '../../arduino-workspace-resolver';
|
||||||
@ -109,4 +110,18 @@ export class WorkspaceService extends TheiaWorkspaceService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected openWindow(uri: FileStat, options?: WorkspaceInput): void {
|
||||||
|
const workspacePath = new URI(uri.uri).path.toString();
|
||||||
|
try {
|
||||||
|
this.openNewWindow(workspacePath);
|
||||||
|
if (this.shouldPreserveWindow(options)) {
|
||||||
|
setTimeout(() => window.close(), 10);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
// Fall back to reloading the current window in case the browser has blocked the new window
|
||||||
|
(this as any)._workspace = uri;
|
||||||
|
this.logger.error(error.toString()).then(() => this.reloadWindow());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user