WIP: feat: unify launch and debug configurations#1464
Conversation
📝 WalkthroughWalkthroughThe PR establishes an extension-point mechanism for plugins to contribute default values to Eclipse launch configurations. It defines ChangesLaunch Defaults Extension Framework
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
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
📒 Files selected for processing (10)
bundles/com.espressif.idf.core/plugin.xmlbundles/com.espressif.idf.core/schema/launchDefaultsContributor.exsdbundles/com.espressif.idf.core/src/com/espressif/idf/core/util/ILaunchDefaultsContributor.javabundles/com.espressif.idf.debug.gdbjtag.openocd/plugin.xmlbundles/com.espressif.idf.debug.gdbjtag.openocd/src/com/espressif/idf/debug/gdbjtag/openocd/preferences/OpenOCDDefaultsInjector.javabundles/com.espressif.idf.launch.serial.core/plugin.xmlbundles/com.espressif.idf.launch.serial.core/src/com/espressif/idf/launch/serial/core/IDFCoreLaunchConfigProvider.javabundles/com.espressif.idf.launch.serial.ui/plugin.xmlbundles/com.espressif.idf.ui/src/com/espressif/idf/ui/handlers/RunActionHandler.javabundles/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
| <documentation> | ||
| [Enter description of this extension point.] | ||
| </documentation> |
There was a problem hiding this comment.
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.
| 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); | ||
| } |
There was a problem hiding this comment.
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.
| 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.
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.
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 Configuration:
Dependent components impacted by this PR:
Checklist
Summary by CodeRabbit
Release Notes
New Features
Changes