From a32153f72e091034132484ccd325d6c06c056200 Mon Sep 17 00:00:00 2001 From: Akos Kitta Date: Fri, 26 Jan 2024 16:48:21 +0100 Subject: [PATCH] feat: disable debug widget if unsupported by board Remove the 'Add configuration...' select option from the debug widget. Closes #14 Signed-off-by: Akos Kitta --- .../browser/arduino-ide-frontend-module.ts | 9 ++- .../src/browser/contributions/debug.ts | 28 +++++++-- .../src/browser/style/debug.css | 41 +++---------- .../debug/debug-configuration-widget.tsx | 19 +++++++ .../src/browser/theia/debug/debug-widget.ts | 57 +++++++++++++++++++ 5 files changed, 115 insertions(+), 39 deletions(-) create mode 100644 arduino-ide-extension/src/browser/theia/debug/debug-widget.ts diff --git a/arduino-ide-extension/src/browser/arduino-ide-frontend-module.ts b/arduino-ide-extension/src/browser/arduino-ide-frontend-module.ts index f481dfc21..89b2b218d 100644 --- a/arduino-ide-extension/src/browser/arduino-ide-frontend-module.ts +++ b/arduino-ide-extension/src/browser/arduino-ide-frontend-module.ts @@ -180,7 +180,7 @@ import { TabBarRenderer } from './theia/core/tab-bars'; import { EditorCommandContribution } from './theia/editor/editor-command'; import { NavigatorTabBarDecorator as TheiaNavigatorTabBarDecorator } from '@theia/navigator/lib/browser/navigator-tab-bar-decorator'; import { NavigatorTabBarDecorator } from './theia/navigator/navigator-tab-bar-decorator'; -import { Debug } from './contributions/debug'; +import { Debug, DebugDisabledStatusMessageSource } from './contributions/debug'; import { Sketchbook } from './contributions/sketchbook'; import { DebugFrontendApplicationContribution } from './theia/debug/debug-frontend-application-contribution'; import { DebugFrontendApplicationContribution as TheiaDebugFrontendApplicationContribution } from '@theia/debug/lib/browser/debug-frontend-application-contribution'; @@ -365,7 +365,8 @@ import { AutoSelectProgrammer } from './contributions/auto-select-programmer'; import { HostedPluginSupport } from './hosted/hosted-plugin-support'; import { DebugSessionManager as TheiaDebugSessionManager } from '@theia/debug/lib/browser/debug-session-manager'; import { DebugSessionManager } from './theia/debug/debug-session-manager'; -import { DebugWidget } from '@theia/debug/lib/browser/view/debug-widget'; +import { DebugWidget as TheiaDebugWidget } from '@theia/debug/lib/browser/view/debug-widget'; +import { DebugWidget } from './theia/debug/debug-widget'; import { DebugViewModel } from '@theia/debug/lib/browser/view/debug-view-model'; import { DebugSessionWidget } from '@theia/debug/lib/browser/view/debug-session-widget'; import { DebugConfigurationWidget } from './theia/debug/debug-configuration-widget'; @@ -771,6 +772,8 @@ export default new ContainerModule((bind, unbind, isBound, rebind) => { bindContributionProvider(bind, StartupTaskProvider); bind(StartupTaskProvider).toService(BoardsServiceProvider); // to reuse the boards config in another window + bind(DebugDisabledStatusMessageSource).toService(Debug); + // Disabled the quick-pick customization from Theia when multiple formatters are available. // Use the default VS Code behavior, and pick the first one. In the IDE2, clang-format has `exclusive` selectors. bind(MonacoFormattingConflictsContribution).toSelf().inSingletonScope(); @@ -874,7 +877,7 @@ export default new ContainerModule((bind, unbind, isBound, rebind) => { // Customized debug widget with its customized config