Skip to content

WIP: feat: unify launch and debug configurations#1464

Open
sigmaaa wants to merge 1 commit into
masterfrom
unify_launch_and_debug_configs
Open

WIP: feat: unify launch and debug configurations#1464
sigmaaa wants to merge 1 commit into
masterfrom
unify_launch_and_debug_configs

Conversation

@sigmaaa
Copy link
Copy Markdown
Collaborator

@sigmaaa sigmaaa commented May 18, 2026

Description

Please include a summary of the change and which issue is fixed.

Fixes # (IEP-XXX)

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How has this been tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • Test A
  • Test B

Test Configuration:

  • ESP-IDF Version:
  • OS (Windows,Linux and macOS):

Dependent components impacted by this PR:

  • Component 1
  • Component 2

Checklist

  • PR Self Reviewed
  • Applied Code formatting
  • Added Documentation
  • Added Unit Test
  • Verified on all platforms - Windows,Linux and macOS

Summary by CodeRabbit

Release Notes

  • New Features

    • Extensible mechanism for applying custom default values to launch configurations.
    • Launch configuration UI tabs now associated with specific launch delegates.
  • Changes

    • Simplified run/debug action handling.
    • Updated launch delegate mode restrictions and configuration initialization.
    • Removed automatic debug configuration creation from project wizard.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 18, 2026

📝 Walkthrough

Walkthrough

The PR establishes an extension-point mechanism for plugins to contribute default values to Eclipse launch configurations. It defines ILaunchDefaultsContributor as a plugin contract, implements OpenOCDDefaultsInjector to supply OpenOCD-specific defaults, wires it through serial core's configuration provider, updates launch tab routing, and simplifies run-handler logic by removing conditional descriptor selection and wizard prompting.

Changes

Launch Defaults Extension Framework

Layer / File(s) Summary
Extension Point Contract and Schema
bundles/com.espressif.idf.core/plugin.xml, bundles/com.espressif.idf.core/schema/launchDefaultsContributor.exsd, bundles/com.espressif.idf.core/src/com/espressif/idf/core/util/ILaunchDefaultsContributor.java
com.espressif.idf.core.launchDefaultsContributor extension point is declared with schema and public interface ILaunchDefaultsContributor, allowing plugins to implement applyDefaults(ILaunchConfigurationWorkingCopy) to inject defaults into new launch configurations.
OpenOCD Defaults Injector Implementation
bundles/com.espressif.idf.debug.gdbjtag.openocd/src/com/espressif/idf/debug/gdbjtag/openocd/preferences/OpenOCDDefaultsInjector.java
OpenOCDDefaultsInjector implements the interface and populates launch configuration with OpenOCD/GDB defaults from preferences: program name, JTAG device, GDB server executable/ports/logging, GDB client behavior, SVD paths, reset/semi-hosting commands, load/symbol options, and final client/server configuration flags.
OpenOCD Plugin Extension Wiring
bundles/com.espressif.idf.debug.gdbjtag.openocd/plugin.xml
OpenOCD registers OpenOCDDefaultsInjector in the extension point, introduces a unified debug delegate targeting the serial launch configuration type, and reorganizes launch configuration tabs into legacy and serial-based layouts with proper delegate routing via associatedDelegate elements.
Serial Core Extension Point Integration
bundles/com.espressif.idf.launch.serial.core/plugin.xml, bundles/com.espressif.idf.launch.serial.core/src/com/espressif/idf/launch/serial/core/IDFCoreLaunchConfigProvider.java
Serial core's launch delegate mode is restricted to run only; IDFCoreLaunchConfigProvider.populateLaunchConfiguration() loads and invokes all registered launch-defaults contributors, sets project-level CDT build configuration attributes, and enforces workspace build-before-launch setting.
Serial UI Delegate Routing and Handler Simplification
bundles/com.espressif.idf.launch.serial.ui/plugin.xml, bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/handlers/RunActionHandler.java
Launch tabs are wired to serial core delegate via associatedDelegate; RunActionHandler.execute() is simplified to check unified configuration type and directly invoke DebugUITools.launch(), removing prior multi-mode branching, descriptor selection, and conditional launch logic.
Wizard Default Config Creation Removal
bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/wizard/NewIDFProjectWizard.java
createDefaultDebugConfig() helper method is removed from NewIDFProjectWizard.performFinish() and replaced with direct launchBarManager.getActiveLaunchConfiguration() call, eliminating wizard-based configuration creation now handled by the extension-point framework.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • espressif/idf-eclipse-plugin#1000: Both modify NewIDFProjectWizard's default debug-configuration creation logic via removal of createDefaultDebugConfig() method.
  • espressif/idf-eclipse-plugin#1407: Both update org.eclipse.debug.ui.launchConfigurationTabs extensions in bundles/com.espressif.idf.debug.gdbjtag.openocd/plugin.xml with tab group registrations and delegate routing.
  • espressif/idf-eclipse-plugin#993: Both adjust launch-mode wiring in RunActionHandler to determine mode from active configuration type rather than user selection branching.

Suggested reviewers

  • AndriiFilippov
  • kolipakakondal
  • alirana01

Poem

🐰 A framework for defaults, clean and bright,
Extension points guiding each launch in flight,
OpenOCD dreams injected with care,
Handlers simplified, no branching despair,
Config flows unified—a rabbit's delight!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'unify launch and debug configurations' directly relates to the main changes, which establish a plugin extension point and infrastructure to unify launch and debug configuration handling across multiple bundles.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch unify_launch_and_debug_configs

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@bundles/com.espressif.idf.core/schema/launchDefaultsContributor.exsd`:
- Around line 8-10: The schema's <documentation> placeholders in
launchDefaultsContributor.exsd must be replaced with concrete descriptions for
the public extension contract: locate each <documentation> element inside the
extension point (the current placeholder text "[Enter description of this
extension point.]") and replace it with a clear summary of the extension's
purpose, the contract contributors must implement (expected XML
attributes/elements or extension IDs), required/optional behavior, and a short
example or usage note so implementers know how to provide launch defaults;
update all occurrences (the five placeholder documentation nodes) to use this
concrete content so contributor authors can implement correctly.

In
`@bundles/com.espressif.idf.launch.serial.core/src/com/espressif/idf/launch/serial/core/IDFCoreLaunchConfigProvider.java`:
- Around line 85-98: The loop that invokes
element.createExecutableExtension("class") and then calls
ILaunchDefaultsContributor.applyDefaults(workingCopy) must be hardened so
unchecked exceptions from contributors don't abort config creation; wrap the
contributor execution (the createExecutableExtension call and the applyDefaults
invocation on the ILaunchDefaultsContributor) in a broader try/catch that
catches Exception, and in that catch log the contributor identity (e.g.,
element.getAttribute("class") or element.toString()) along with the exception
via Logger.log so failures are isolated and recorded; keep the existing
CoreException handling but add the generic Exception handler around the
contributor invocation path.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 8ea3307d-ef3b-455a-847b-f31d5aa1a56d

📥 Commits

Reviewing files that changed from the base of the PR and between 559f443 and 6d61c70.

📒 Files selected for processing (10)
  • bundles/com.espressif.idf.core/plugin.xml
  • bundles/com.espressif.idf.core/schema/launchDefaultsContributor.exsd
  • bundles/com.espressif.idf.core/src/com/espressif/idf/core/util/ILaunchDefaultsContributor.java
  • bundles/com.espressif.idf.debug.gdbjtag.openocd/plugin.xml
  • bundles/com.espressif.idf.debug.gdbjtag.openocd/src/com/espressif/idf/debug/gdbjtag/openocd/preferences/OpenOCDDefaultsInjector.java
  • bundles/com.espressif.idf.launch.serial.core/plugin.xml
  • bundles/com.espressif.idf.launch.serial.core/src/com/espressif/idf/launch/serial/core/IDFCoreLaunchConfigProvider.java
  • bundles/com.espressif.idf.launch.serial.ui/plugin.xml
  • bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/handlers/RunActionHandler.java
  • bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/wizard/NewIDFProjectWizard.java
💤 Files with no reviewable changes (1)
  • bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/wizard/NewIDFProjectWizard.java

Comment on lines +8 to +10
<documentation>
[Enter description of this extension point.]
</documentation>
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Replace PDE placeholder documentation before publishing this extension point.

Line 9, Line 70, Line 79, Line 88, and Line 97 still contain template placeholders. For a new public extension contract, these should be concrete so contributor authors can implement it correctly.

Also applies to: 69-71, 78-80, 87-89, 96-98

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@bundles/com.espressif.idf.core/schema/launchDefaultsContributor.exsd` around
lines 8 - 10, The schema's <documentation> placeholders in
launchDefaultsContributor.exsd must be replaced with concrete descriptions for
the public extension contract: locate each <documentation> element inside the
extension point (the current placeholder text "[Enter description of this
extension point.]") and replace it with a clear summary of the extension's
purpose, the contract contributors must implement (expected XML
attributes/elements or extension IDs), required/optional behavior, and a short
example or usage note so implementers know how to provide launch defaults;
update all occurrences (the five placeholder documentation nodes) to use this
concrete content so contributor authors can implement correctly.

Comment on lines +85 to +98
for (IConfigurationElement element : elements)
{
try
{
Object obj = element.createExecutableExtension("class"); //$NON-NLS-1$
if (obj instanceof ILaunchDefaultsContributor launchDefaultsContributor)
{
launchDefaultsContributor.applyDefaults(workingCopy);
}
}
catch (CoreException e)
{
Logger.log(e);
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Isolate contributor failures from launch configuration creation.

At Line 92, applyDefaults(...) is only guarded by a catch (CoreException). If any contributor throws an unchecked exception, config creation can fail entirely. Catch Exception around contributor execution and log contributor identity.

Proposed hardening patch
 		for (IConfigurationElement element : elements)
 		{
 			try
 			{
 				Object obj = element.createExecutableExtension("class"); //$NON-NLS-1$
 				if (obj instanceof ILaunchDefaultsContributor launchDefaultsContributor)
 				{
-					launchDefaultsContributor.applyDefaults(workingCopy);
+					try
+					{
+						launchDefaultsContributor.applyDefaults(workingCopy);
+					}
+					catch (Exception e)
+					{
+						Logger.log("Launch defaults contributor failed: " + element.getContributor().getName(), e); //$NON-NLS-1$
+					}
 				}
 			}
 			catch (CoreException e)
 			{
 				Logger.log(e);
 			}
 		}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
for (IConfigurationElement element : elements)
{
try
{
Object obj = element.createExecutableExtension("class"); //$NON-NLS-1$
if (obj instanceof ILaunchDefaultsContributor launchDefaultsContributor)
{
launchDefaultsContributor.applyDefaults(workingCopy);
}
}
catch (CoreException e)
{
Logger.log(e);
}
for (IConfigurationElement element : elements)
{
try
{
Object obj = element.createExecutableExtension("class"); //$NON-NLS-1$
if (obj instanceof ILaunchDefaultsContributor launchDefaultsContributor)
{
try
{
launchDefaultsContributor.applyDefaults(workingCopy);
}
catch (Exception e)
{
Logger.log("Launch defaults contributor failed: " + element.getContributor().getName(), e); //$NON-NLS-1$
}
}
}
catch (CoreException e)
{
Logger.log(e);
}
}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@bundles/com.espressif.idf.launch.serial.core/src/com/espressif/idf/launch/serial/core/IDFCoreLaunchConfigProvider.java`
around lines 85 - 98, The loop that invokes
element.createExecutableExtension("class") and then calls
ILaunchDefaultsContributor.applyDefaults(workingCopy) must be hardened so
unchecked exceptions from contributors don't abort config creation; wrap the
contributor execution (the createExecutableExtension call and the applyDefaults
invocation on the ILaunchDefaultsContributor) in a broader try/catch that
catches Exception, and in that catch log the contributor identity (e.g.,
element.getAttribute("class") or element.toString()) along with the exception
via Logger.log so failures are isolated and recorded; keep the existing
CoreException handling but add the generic Exception handler around the
contributor invocation path.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant