Hi, I want to use fixed debug configuration instead of user configuration in launch.json.
I don’t see any related contribution api. Is there an easy way to achieve it?
Thanks.
Hi, I want to use fixed debug configuration instead of user configuration in launch.json.
I don’t see any related contribution api. Is there an easy way to achieve it?
Thanks.
Sorry, I don’t understand what mean, can you be more concrete, give an example maybe?
I want to realize that it can be debugged without writing launch.json.
Maybe I need override “debug-configuration-widget”
I solved it with override DebugConfigurationManager
@injectable()
export class CustomDebugConfigurationManager extends DebugConfigurationManager {
protected updateModels = debounce(async () => {
const roots = await this.workspaceService.roots;
const toDelete = new Set(this.models.keys());
for (const rootStat of roots) {
const key = rootStat.resource.toString();
toDelete.delete(key);
let customConfiguration:DebugConfiguration= {
name: "builtin debugger",
type: "python",
request: "attach",
}
const model = this.models.get(key);
if (model) {
model.configurations.unshift(customConfiguration);
}else{
const model = new DebugConfigurationModel(key, this.preferences);
model.configurations.unshift(customConfiguration)
model.onDidChange(() => this.updateCurrent());
model.onDispose(() => this.models.delete(key));
this.models.set(key, model);
}
}
for (const uri of toDelete) {
const model = this.models.get(uri);
console.log("del:", uri);
if (model) {
model.dispose();
}
}
this.updateCurrent();
}, 500);
}
bind(CustomDebugConfigurationManager).toSelf().inSingletonScope();
rebind(DebugConfigurationManager).to(CustomDebugConfigurationManager);