|
1 | 1 | import '../../src/browser/style/index.css';
|
2 |
| -import { ContainerModule } from '@theia/core/shared/inversify'; |
| 2 | +import { Container, ContainerModule } from '@theia/core/shared/inversify'; |
3 | 3 | import { WidgetFactory } from '@theia/core/lib/browser/widget-manager';
|
4 | 4 | import { CommandContribution } from '@theia/core/lib/common/command';
|
5 | 5 | import { bindViewContribution } from '@theia/core/lib/browser/shell/view-contribution';
|
@@ -363,6 +363,14 @@ import { CommandService } from '@theia/core/lib/common/command';
|
363 | 363 | import { CorePreferences } from '@theia/core/lib/browser/core-preferences';
|
364 | 364 | import { AutoSelectProgrammer } from './contributions/auto-select-programmer';
|
365 | 365 | import { HostedPluginSupport } from './hosted/hosted-plugin-support';
|
| 366 | +import { DebugSessionManager as TheiaDebugSessionManager } from '@theia/debug/lib/browser/debug-session-manager'; |
| 367 | +import { DebugSessionManager } from './theia/debug/debug-session-manager'; |
| 368 | +import { DebugWidget } from '@theia/debug/lib/browser/view/debug-widget'; |
| 369 | +import { DebugViewModel } from '@theia/debug/lib/browser/view/debug-view-model'; |
| 370 | +import { DebugSessionWidget } from '@theia/debug/lib/browser/view/debug-session-widget'; |
| 371 | +import { DebugConfigurationWidget } from './theia/debug/debug-configuration-widget'; |
| 372 | +import { DebugConfigurationWidget as TheiaDebugConfigurationWidget } from '@theia/debug/lib/browser/view/debug-configuration-widget'; |
| 373 | +import { DebugToolBar } from '@theia/debug/lib/browser/view/debug-toolbar-widget'; |
366 | 374 |
|
367 | 375 | // Hack to fix copy/cut/paste issue after electron version update in Theia.
|
368 | 376 | // https://github.com/eclipse-theia/theia/issues/12487
|
@@ -860,6 +868,28 @@ export default new ContainerModule((bind, unbind, isBound, rebind) => {
|
860 | 868 | // To be able to use a `launch.json` from outside of the workspace.
|
861 | 869 | bind(DebugConfigurationManager).toSelf().inSingletonScope();
|
862 | 870 | rebind(TheiaDebugConfigurationManager).toService(DebugConfigurationManager);
|
| 871 | + // To update the currently selected debug config <select> option when starting a debug session. |
| 872 | + bind(DebugSessionManager).toSelf().inSingletonScope(); |
| 873 | + rebind(TheiaDebugSessionManager).toService(DebugSessionManager); |
| 874 | + // Customized debug widget with its customized config <select> to update it programmatically. |
| 875 | + bind(WidgetFactory) |
| 876 | + .toDynamicValue(({ container }) => ({ |
| 877 | + id: DebugWidget.ID, |
| 878 | + createWidget: () => { |
| 879 | + const child = new Container({ defaultScope: 'Singleton' }); |
| 880 | + child.parent = container; |
| 881 | + child.bind(DebugViewModel).toSelf(); |
| 882 | + child.bind(DebugToolBar).toSelf(); |
| 883 | + child.bind(DebugSessionWidget).toSelf(); |
| 884 | + child.bind(DebugConfigurationWidget).toSelf(); // with the patched select |
| 885 | + child // use the customized one in the Theia DI |
| 886 | + .bind(TheiaDebugConfigurationWidget) |
| 887 | + .toService(DebugConfigurationWidget); |
| 888 | + child.bind(DebugWidget).toSelf(); |
| 889 | + return child.get(DebugWidget); |
| 890 | + }, |
| 891 | + })) |
| 892 | + .inSingletonScope(); |
863 | 893 |
|
864 | 894 | // To avoid duplicate tabs use deepEqual instead of string equal: https://github.com/eclipse-theia/theia/issues/11309
|
865 | 895 | bind(WidgetManager).toSelf().inSingletonScope();
|
|
0 commit comments