mirror of
https://github.com/arduino/arduino-ide.git
synced 2025-11-21 08:06:10 +00:00
Improved creation of default debug configurations
This commit is contained in:
@@ -4,13 +4,36 @@ 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();
|
||||
get defaultDebugger(): Promise<string | undefined> {
|
||||
return this.debug.getDebuggersForLanguage('ino').then(debuggers => {
|
||||
if (debuggers.length === 0)
|
||||
return undefined;
|
||||
return debuggers[0].type;
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
protected async selectDebugType(): Promise<string | undefined> {
|
||||
const widget = this.editorManager.currentEditor;
|
||||
if (!widget) {
|
||||
return this.defaultDebugger;
|
||||
}
|
||||
const { languageId } = widget.editor.document;
|
||||
const debuggers = await this.debug.getDebuggersForLanguage(languageId);
|
||||
if (debuggers.length === 0) {
|
||||
return this.defaultDebugger;
|
||||
}
|
||||
return this.quickPick.show(debuggers.map(
|
||||
({ label, type }) => ({ label, value: type }),
|
||||
{ placeholder: 'Select Environment' })
|
||||
);
|
||||
}
|
||||
|
||||
async createDefaultConfiguration(): Promise<void> {
|
||||
const { model } = this;
|
||||
if (model) {
|
||||
await this.doCreate(model);
|
||||
await this.updateModels();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user