mirror of
https://github.com/arduino/arduino-ide.git
synced 2025-07-13 14:26:37 +00:00
Integrate with classic mode and start debugging immediately
This commit is contained in:
parent
68ff6acb6a
commit
5baf43bf25
@ -0,0 +1,16 @@
|
|||||||
|
import { DebugConfigurationManager } from "@theia/debug/lib/browser/debug-configuration-manager";
|
||||||
|
import { injectable } from "inversify";
|
||||||
|
|
||||||
|
@injectable()
|
||||||
|
export class ArduinoDebugConfigurationManager extends DebugConfigurationManager {
|
||||||
|
|
||||||
|
async addConfiguration() {
|
||||||
|
const { model } = this;
|
||||||
|
if (!model) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
await this.doCreate(model);
|
||||||
|
await this.updateModels();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,30 @@
|
|||||||
|
import { injectable } from "inversify";
|
||||||
|
import { DebugFrontendApplicationContribution } from '@theia/debug/lib/browser/debug-frontend-application-contribution';
|
||||||
|
import { DebugSessionOptions } from "@theia/debug/lib/browser/debug-session-options";
|
||||||
|
|
||||||
|
@injectable()
|
||||||
|
export class ArduinoDebugFrontendApplicationContribution extends DebugFrontendApplicationContribution {
|
||||||
|
|
||||||
|
async start(noDebug?: boolean, debugSessionOptions?: DebugSessionOptions): Promise<void> {
|
||||||
|
let current = debugSessionOptions ? debugSessionOptions : this.configurations.current;
|
||||||
|
// If no configurations are currently present, create the `launch.json` and prompt users to select the config.
|
||||||
|
if (!current) {
|
||||||
|
await this.configurations.addConfiguration();
|
||||||
|
await this.configurations.load()
|
||||||
|
current = this.configurations.current;
|
||||||
|
}
|
||||||
|
if (current) {
|
||||||
|
if (noDebug !== undefined) {
|
||||||
|
current = {
|
||||||
|
...current,
|
||||||
|
configuration: {
|
||||||
|
...current.configuration,
|
||||||
|
noDebug
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
await this.manager.start(current);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,8 +1,24 @@
|
|||||||
import { ContainerModule } from 'inversify';
|
import { ContainerModule } from 'inversify';
|
||||||
import { VariableContribution } from '@theia/variable-resolver/lib/browser';
|
import { VariableContribution } from '@theia/variable-resolver/lib/browser';
|
||||||
import { ArduinoVariableResolver } from './arduino-variable-resolver';
|
import { ArduinoVariableResolver } from './arduino-variable-resolver';
|
||||||
|
import { ArduinoAdvancedMode } from 'arduino-ide-extension/lib/browser/arduino-frontend-contribution';
|
||||||
|
import { DebugFrontendApplicationContribution } from '@theia/debug/lib/browser/debug-frontend-application-contribution';
|
||||||
|
import { SilentDebugFrontendApplicationContribution } from './silent-debug-frontend-application-contribution';
|
||||||
|
import { DebugConfigurationManager } from '@theia/debug/lib/browser/debug-configuration-manager';
|
||||||
|
import { ArduinoDebugConfigurationManager } from './arduino-debug-configuration-manager';
|
||||||
|
import { ArduinoDebugFrontendApplicationContribution } from './arduino-debug-frontend-application-contribution';
|
||||||
|
|
||||||
export default new ContainerModule((bind, unbind, isBound, rebind) => {
|
export default new ContainerModule((bind, unbind, isBound, rebind) => {
|
||||||
bind(ArduinoVariableResolver).toSelf().inSingletonScope();
|
bind(ArduinoVariableResolver).toSelf().inSingletonScope();
|
||||||
bind(VariableContribution).toService(ArduinoVariableResolver);
|
bind(VariableContribution).toService(ArduinoVariableResolver);
|
||||||
|
|
||||||
|
if (!ArduinoAdvancedMode.TOGGLED) {
|
||||||
|
unbind(DebugFrontendApplicationContribution);
|
||||||
|
bind(DebugFrontendApplicationContribution).to(SilentDebugFrontendApplicationContribution);
|
||||||
|
} else {
|
||||||
|
unbind(DebugConfigurationManager);
|
||||||
|
bind(DebugConfigurationManager).to(ArduinoDebugConfigurationManager).inSingletonScope();
|
||||||
|
unbind(DebugFrontendApplicationContribution);
|
||||||
|
bind(DebugFrontendApplicationContribution).to(ArduinoDebugFrontendApplicationContribution);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
@ -0,0 +1,25 @@
|
|||||||
|
import { injectable } from "inversify";
|
||||||
|
import { DebugFrontendApplicationContribution } from '@theia/debug/lib/browser/debug-frontend-application-contribution';
|
||||||
|
import { MenuModelRegistry, CommandRegistry } from "@theia/core";
|
||||||
|
import { KeybindingRegistry } from "@theia/core/lib/browser";
|
||||||
|
import { TabBarToolbarRegistry } from "@theia/core/lib/browser/shell/tab-bar-toolbar";
|
||||||
|
|
||||||
|
@injectable()
|
||||||
|
export class SilentDebugFrontendApplicationContribution extends DebugFrontendApplicationContribution {
|
||||||
|
|
||||||
|
async initializeLayout(): Promise<void> {
|
||||||
|
}
|
||||||
|
|
||||||
|
registerMenus(menus: MenuModelRegistry): void {
|
||||||
|
}
|
||||||
|
|
||||||
|
registerCommands(registry: CommandRegistry): void {
|
||||||
|
}
|
||||||
|
|
||||||
|
registerKeybindings(keybindings: KeybindingRegistry): void {
|
||||||
|
}
|
||||||
|
|
||||||
|
registerToolbarItems(toolbar: TabBarToolbarRegistry): void {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user