mirror of
https://github.com/arduino/arduino-ide.git
synced 2025-06-16 00:56:33 +00:00
Updated code to current version
This commit is contained in:
parent
2ffca88c02
commit
38ab95973e
@ -1,10 +1,17 @@
|
||||
import { injectable } from "inversify";
|
||||
import { injectable, inject } from 'inversify';
|
||||
import { MenuModelRegistry } from '@theia/core';
|
||||
import { KeybindingRegistry } from '@theia/core/lib/browser';
|
||||
import { TabBarToolbarRegistry } from '@theia/core/lib/browser/shell/tab-bar-toolbar';
|
||||
import { DebugFrontendApplicationContribution } from '@theia/debug/lib/browser/debug-frontend-application-contribution';
|
||||
import { DebugSessionOptions } from "@theia/debug/lib/browser/debug-session-options";
|
||||
import { EditorMode } from "arduino-ide-extension/lib/browser/editor-mode";
|
||||
|
||||
@injectable()
|
||||
export class ArduinoDebugFrontendApplicationContribution extends DebugFrontendApplicationContribution {
|
||||
|
||||
@inject(EditorMode)
|
||||
protected readonly editorMode: EditorMode;
|
||||
|
||||
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.
|
||||
@ -27,4 +34,25 @@ export class ArduinoDebugFrontendApplicationContribution extends DebugFrontendAp
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
initializeLayout(): Promise<void> {
|
||||
if (this.editorMode.proMode)
|
||||
return super.initializeLayout();
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
registerMenus(menus: MenuModelRegistry): void {
|
||||
if (this.editorMode.proMode)
|
||||
super.registerMenus(menus);
|
||||
}
|
||||
|
||||
registerKeybindings(keybindings: KeybindingRegistry): void {
|
||||
if (this.editorMode.proMode)
|
||||
super.registerKeybindings(keybindings);
|
||||
}
|
||||
|
||||
registerToolbarItems(toolbar: TabBarToolbarRegistry): void {
|
||||
if (this.editorMode.proMode)
|
||||
super.registerToolbarItems(toolbar);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,9 +1,7 @@
|
||||
import { ContainerModule } from 'inversify';
|
||||
import { VariableContribution } from '@theia/variable-resolver/lib/browser';
|
||||
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';
|
||||
@ -11,14 +9,6 @@ import { ArduinoDebugFrontendApplicationContribution } from './arduino-debug-fro
|
||||
export default new ContainerModule((bind, unbind, isBound, rebind) => {
|
||||
bind(ArduinoVariableResolver).toSelf().inSingletonScope();
|
||||
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);
|
||||
}
|
||||
rebind(DebugConfigurationManager).to(ArduinoDebugConfigurationManager).inSingletonScope();
|
||||
rebind(DebugFrontendApplicationContribution).to(ArduinoDebugFrontendApplicationContribution);
|
||||
});
|
||||
|
@ -1,25 +0,0 @@
|
||||
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 {
|
||||
}
|
||||
|
||||
}
|
@ -32,7 +32,7 @@ import { CmsisBackend } from './cmsis-backend';
|
||||
// import { PyocdServer } from './pyocd-server';
|
||||
import { PortScanner } from './port-scanner';
|
||||
import { SymbolTable } from './symbols';
|
||||
import * as varMgr from 'cdt-gdb-adapter/dist/varManager';
|
||||
import { VarManager } from 'cdt-gdb-adapter/dist/varManager';
|
||||
import * as mi from './mi';
|
||||
import { OpenocdServer } from './openocd-server';
|
||||
|
||||
@ -54,13 +54,16 @@ export class CmsisDebugSession extends GDBDebugSession {
|
||||
protected portScanner = new PortScanner();
|
||||
protected symbolTable!: SymbolTable;
|
||||
protected globalHandle!: number;
|
||||
protected varMgr: VarManager;
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
}
|
||||
|
||||
protected createBackend(): GDBBackend {
|
||||
return new CmsisBackend();
|
||||
const gdb = new CmsisBackend();
|
||||
this.varMgr = new VarManager(gdb);
|
||||
return gdb;
|
||||
}
|
||||
|
||||
protected async launchRequest(response: DebugProtocol.LaunchResponse, args: CmsisRequestArguments): Promise<void> {
|
||||
@ -334,7 +337,7 @@ export class CmsisDebugSession extends GDBDebugSession {
|
||||
}
|
||||
|
||||
private async getVariables(frame: FrameReference, name: string, expression: string, depth: number): Promise<DebugProtocol.Variable> {
|
||||
let global = varMgr.getVar(frame.frameId, frame.threadId, depth, name);
|
||||
let global = this.varMgr.getVar(frame.frameId, frame.threadId, depth, name);
|
||||
|
||||
if (global) {
|
||||
// Update value if it is already loaded
|
||||
@ -351,7 +354,7 @@ export class CmsisDebugSession extends GDBDebugSession {
|
||||
expression,
|
||||
});
|
||||
|
||||
global = varMgr.addVar(frame.frameId, frame.threadId, depth, name, true, false, varCreateResponse);
|
||||
global = this.varMgr.addVar(frame.frameId, frame.threadId, depth, name, true, false, varCreateResponse);
|
||||
}
|
||||
|
||||
return {
|
||||
|
Loading…
x
Reference in New Issue
Block a user