mirror of
https://github.com/arduino/arduino-ide.git
synced 2025-04-19 12:57:17 +00:00
No disconnect/reconnect when DNDing the widget.
- Updated to next Theia, - Added elecron launch config, - Yet another syling for the input + selects, - Close monitor connection on widget close not detach. Signed-off-by: Akos Kitta <kittaakos@typefox.io>
This commit is contained in:
parent
6154d1e8d5
commit
2f33038695
42
.vscode/launch.json
vendored
42
.vscode/launch.json
vendored
@ -7,14 +7,39 @@
|
||||
{
|
||||
"type": "node",
|
||||
"request": "launch",
|
||||
"name": "Launch Electron Packager",
|
||||
"program": "${workspaceRoot}/electron/packager/index.js",
|
||||
"cwd": "${workspaceFolder}/electron/packager"
|
||||
"name": "App (Electron)",
|
||||
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/electron",
|
||||
"windows": {
|
||||
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/electron.cmd"
|
||||
},
|
||||
"program": "${workspaceRoot}/electron-app/src-gen/frontend/electron-main.js",
|
||||
"protocol": "inspector",
|
||||
"args": [
|
||||
"--log-level=debug",
|
||||
"--hostname=localhost",
|
||||
"--no-cluster",
|
||||
"--remote-debugging-port=9222",
|
||||
"--no-app-auto-install",
|
||||
"--debug-cli=true"
|
||||
],
|
||||
"env": {
|
||||
"NODE_ENV": "development"
|
||||
},
|
||||
"sourceMaps": true,
|
||||
"outFiles": [
|
||||
"${workspaceRoot}/electron-app/src-gen/backend/*.js",
|
||||
"${workspaceRoot}/electron-app/src-gen/frontend/*.js",
|
||||
"${workspaceRoot}/electron-app/lib/**/*.js",
|
||||
"${workspaceRoot}/arduino-ide-extension/*/lib/**/*.js"
|
||||
],
|
||||
"smartStep": true,
|
||||
"internalConsoleOptions": "openOnSessionStart",
|
||||
"outputCapture": "std"
|
||||
},
|
||||
{
|
||||
"type": "node",
|
||||
"request": "launch",
|
||||
"name": "Launch Backend",
|
||||
"name": "App (Browser)",
|
||||
"program": "${workspaceRoot}/browser-app/src-gen/backend/main.js",
|
||||
"args": [
|
||||
"--hostname=0.0.0.0",
|
||||
@ -38,7 +63,7 @@
|
||||
{
|
||||
"type": "node",
|
||||
"request": "launch",
|
||||
"name": "Launch Backend (Debug CLI daemon)",
|
||||
"name": "App (Browser - Debug CLI daemon)",
|
||||
"program": "${workspaceRoot}/browser-app/src-gen/backend/main.js",
|
||||
"args": [
|
||||
"--hostname=0.0.0.0",
|
||||
@ -59,6 +84,13 @@
|
||||
"smartStep": true,
|
||||
"internalConsoleOptions": "openOnSessionStart",
|
||||
"outputCapture": "std"
|
||||
},
|
||||
{
|
||||
"type": "node",
|
||||
"request": "launch",
|
||||
"name": "Packager",
|
||||
"program": "${workspaceRoot}/electron/packager/index.js",
|
||||
"cwd": "${workspaceFolder}/electron/packager"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ export class MonitorModel implements FrontendApplicationContribution {
|
||||
this.storeState().then(() => this.onChangeEmitter.fire({ property: 'lineEnding', value: this._lineEnding }));
|
||||
}
|
||||
|
||||
protected restoreState(state: MonitorModel.State) {
|
||||
protected restoreState(state: MonitorModel.State): void {
|
||||
this._autoscroll = state.autoscroll;
|
||||
this._timestamp = state.timestamp;
|
||||
this._baudRate = state.baudRate;
|
||||
@ -86,7 +86,7 @@ export class MonitorModel implements FrontendApplicationContribution {
|
||||
}
|
||||
|
||||
protected async storeState(): Promise<void> {
|
||||
this.localStorageService.setData(MonitorModel.STORAGE_ID, {
|
||||
return this.localStorageService.setData(MonitorModel.STORAGE_ID, {
|
||||
autoscroll: this._autoscroll,
|
||||
timestamp: this._timestamp,
|
||||
baudRate: this._baudRate,
|
||||
|
@ -41,6 +41,7 @@ export class MonitorWidget extends ReactWidget {
|
||||
this.id = MonitorWidget.ID;
|
||||
this.title.label = 'Serial Monitor';
|
||||
this.title.iconClass = 'arduino-serial-monitor-tab-icon';
|
||||
this.title.closable = true;
|
||||
this.scrollOptions = undefined;
|
||||
this.toDispose.push(this.clearOutputEmitter);
|
||||
}
|
||||
@ -56,14 +57,21 @@ export class MonitorWidget extends ReactWidget {
|
||||
this.update();
|
||||
}
|
||||
|
||||
dispose(): void {
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
protected onAfterAttach(msg: Message): void {
|
||||
super.onAfterAttach(msg);
|
||||
this.monitorConnection.autoConnect = true;
|
||||
}
|
||||
|
||||
protected onBeforeDetach(msg: Message): void {
|
||||
super.onBeforeDetach(msg);
|
||||
onCloseRequest(msg: Message): void {
|
||||
this.monitorConnection.autoConnect = false;
|
||||
if (this.monitorConnection.connected) {
|
||||
this.monitorConnection.disconnect();
|
||||
}
|
||||
super.onCloseRequest(msg);
|
||||
}
|
||||
|
||||
protected onResize(msg: Widget.ResizeMessage): void {
|
||||
|
@ -21,7 +21,7 @@
|
||||
.serial-monitor .head .send {
|
||||
display: flex;
|
||||
flex: 1;
|
||||
margin-right: 5px;
|
||||
margin-right: 2px;
|
||||
}
|
||||
|
||||
.serial-monitor .head .send > input {
|
||||
@ -42,7 +42,7 @@
|
||||
}
|
||||
|
||||
.serial-monitor .head .config .select {
|
||||
margin-left: 5px;
|
||||
margin-left: 3px;
|
||||
}
|
||||
|
||||
.serial-monitor .body {
|
||||
|
@ -1,6 +1,7 @@
|
||||
import * as PQueue from 'p-queue';
|
||||
import { injectable, inject, postConstruct, named } from 'inversify';
|
||||
import { ILogger } from '@theia/core/lib/common/logger';
|
||||
import { Deferred } from '@theia/core/lib/common/promise-util';
|
||||
import { BoardsService, AttachedSerialBoard, BoardPackage, Board, AttachedNetworkBoard, BoardsServiceClient, Port } from '../common/protocol/boards-service';
|
||||
import {
|
||||
PlatformSearchReq,
|
||||
@ -43,6 +44,7 @@ export class BoardsServiceImpl implements BoardsService {
|
||||
*/
|
||||
protected attachedBoards: { boards: Board[] } = { boards: [] };
|
||||
protected availablePorts: { ports: Port[] } = { ports: [] };
|
||||
protected started = new Deferred<void>();
|
||||
protected client: BoardsServiceClient | undefined;
|
||||
protected readonly queue = new PQueue({ autoStart: true, concurrency: 1 });
|
||||
|
||||
@ -74,6 +76,7 @@ export class BoardsServiceImpl implements BoardsService {
|
||||
if (!this.discoveryInitialized) {
|
||||
update([], sortedBoards, [], sortedPorts, 'Initialized attached boards and available ports.');
|
||||
this.discoveryInitialized = true;
|
||||
this.started.resolve();
|
||||
} else {
|
||||
Promise.all([
|
||||
this.getAttachedBoards(),
|
||||
@ -120,10 +123,12 @@ export class BoardsServiceImpl implements BoardsService {
|
||||
}
|
||||
|
||||
async getAttachedBoards(): Promise<{ boards: Board[] }> {
|
||||
await this.started.promise;
|
||||
return this.attachedBoards;
|
||||
}
|
||||
|
||||
async getAvailablePorts(): Promise<{ ports: Port[] }> {
|
||||
await this.started.promise;
|
||||
return this.availablePorts;
|
||||
}
|
||||
|
||||
|
@ -71,7 +71,7 @@ export class MonitorServiceImpl implements MonitorService {
|
||||
|
||||
duplex.on('error', ((error: Error) => {
|
||||
const monitorError = ErrorWithCode.toMonitorError(error, config);
|
||||
this.disconnect().then(() => {
|
||||
this.disconnect(monitorError).then(() => {
|
||||
if (this.client) {
|
||||
this.client.notifyError(monitorError);
|
||||
}
|
||||
@ -112,7 +112,10 @@ export class MonitorServiceImpl implements MonitorService {
|
||||
});
|
||||
}
|
||||
|
||||
async disconnect(): Promise<Status> {
|
||||
async disconnect(reason?: MonitorError): Promise<Status> {
|
||||
if (!this.connection && reason && reason.code === MonitorError.ErrorCodes.CLIENT_CANCEL) {
|
||||
return Status.OK;
|
||||
}
|
||||
this.logger.info(`>>> Disposing monitor connection...`);
|
||||
if (!this.connection) {
|
||||
this.logger.warn(`<<< Not connected. Nothing to dispose.`);
|
||||
|
Loading…
x
Reference in New Issue
Block a user