mirror of
https://github.com/arduino/arduino-ide.git
synced 2025-10-21 09:08:32 +00:00
ATL-1206: Reuse selected board for new sketches.
Closes #95. Signed-off-by: Akos Kitta <kittaakos@typefox.io>
This commit is contained in:
@@ -11,6 +11,8 @@ import { WorkspaceService as TheiaWorkspaceService } from '@theia/workspace/lib/
|
||||
import { ConfigService } from '../../../common/protocol/config-service';
|
||||
import { SketchesService, Sketch, SketchContainer } from '../../../common/protocol/sketches-service';
|
||||
import { ArduinoWorkspaceRootResolver } from '../../arduino-workspace-resolver';
|
||||
import { BoardsServiceProvider } from '../../boards/boards-service-provider';
|
||||
import { BoardsConfig } from '../../boards/boards-config';
|
||||
|
||||
@injectable()
|
||||
export class WorkspaceService extends TheiaWorkspaceService {
|
||||
@@ -33,6 +35,9 @@ export class WorkspaceService extends TheiaWorkspaceService {
|
||||
@inject(FrontendApplicationStateService)
|
||||
protected readonly appStateService: FrontendApplicationStateService;
|
||||
|
||||
@inject(BoardsServiceProvider)
|
||||
protected readonly boardsServiceProvider: BoardsServiceProvider;
|
||||
|
||||
private application: FrontendApplication;
|
||||
private workspaceUri?: Promise<string | undefined>;
|
||||
private version?: string;
|
||||
@@ -80,6 +85,13 @@ export class WorkspaceService extends TheiaWorkspaceService {
|
||||
return this.workspaceUri;
|
||||
}
|
||||
|
||||
protected openNewWindow(workspacePath: string): void {
|
||||
const { boardsConfig } = this.boardsServiceProvider;
|
||||
const url = BoardsConfig.Config.setConfig(boardsConfig, new URL(window.location.href)); // Set the current boards config for the new browser window.
|
||||
url.hash = workspacePath;
|
||||
this.windowService.openNewWindow(url.toString());
|
||||
}
|
||||
|
||||
private async isValid(uri: string): Promise<boolean> {
|
||||
const exists = await this.fileService.exists(new URI(uri));
|
||||
if (!exists) {
|
||||
|
Reference in New Issue
Block a user