mirror of
https://github.com/arduino/arduino-ide.git
synced 2025-12-16 03:57:36 +00:00
- Can pick a programmer if missing, - Can auto-select a programmer on app start, - Can edit the `launch.json`, - Adjust board discovery to new gRPC API. From now on, it's a client read stream, not a duplex. - Allow `.cxx` and `.cc` file extensions. (Closes #2265) - Drop `debuggingSupported` from `BoardDetails`. - Dedicated service endpoint for checking the debugger. Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
40 lines
1.5 KiB
TypeScript
40 lines
1.5 KiB
TypeScript
import { inject, injectable } from '@theia/core/shared/inversify';
|
|
import { DebugSession } from '@theia/debug/lib/browser/debug-session';
|
|
import { DebugSessionManager as TheiaDebugSessionManager } from '@theia/debug/lib/browser/debug-session-manager';
|
|
import { DebugConfigurationSessionOptions } from '@theia/debug/lib/browser/debug-session-options';
|
|
import { WorkspaceService } from '@theia/workspace/lib/browser/workspace-service';
|
|
import deepEqual from 'fast-deep-equal';
|
|
|
|
@injectable()
|
|
export class DebugSessionManager extends TheiaDebugSessionManager {
|
|
@inject(WorkspaceService)
|
|
private readonly workspaceService: WorkspaceService;
|
|
|
|
protected override doStart(
|
|
sessionId: string,
|
|
options: DebugConfigurationSessionOptions
|
|
): Promise<DebugSession> {
|
|
this.syncCurrentOptions(options);
|
|
return super.doStart(sessionId, options);
|
|
}
|
|
|
|
/**
|
|
* If the debug config manager knows about the currently started options, and it's not the currently selected one, select it.
|
|
*/
|
|
private syncCurrentOptions(options: DebugConfigurationSessionOptions): void {
|
|
const knownConfigOptions = this.debugConfigurationManager.find(
|
|
options.configuration,
|
|
options.workspaceFolderUri ??
|
|
this.workspaceService
|
|
.tryGetRoots()
|
|
.map((stat) => stat.resource.toString())[0]
|
|
);
|
|
if (
|
|
knownConfigOptions &&
|
|
!deepEqual(knownConfigOptions, this.debugConfigurationManager.current)
|
|
) {
|
|
this.debugConfigurationManager.current = knownConfigOptions;
|
|
}
|
|
}
|
|
}
|