IEP-1694 esp-idf manager view: version number not shown#1421
Conversation
📝 WalkthroughWalkthroughThis pull request enhances ESP-IDF version detection and display by tightening version string parsing in ToolsUtility to handle empty values and whitespace, while adding UI improvements to ESPIDFMainTablePage that display a "Detection Failed" message with warning icons and tooltips when version detection fails, supported by new localized message entries. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 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: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In
`@bundles/com.espressif.idf.core/src/com/espressif/idf/core/tools/util/ToolsUtility.java`:
- Around line 51-54: The current parsing sets espIdfVersion =
line.split("=")[1].trim() which leaves quoted-empty values like "" as non-empty;
update the parsing in ToolsUtility.java (the block that checks
line.startsWith("ESP_IDF_VERSION=") and assigns espIdfVersion) to strip
surrounding double quotes (if present) and treat the result as empty when it
becomes an empty string (e.g., remove leading/trailing '"' after trim or check
for a literal "\"\"" and set espIdfVersion to null/empty), so downstream UI
empty checks correctly trigger the “Detection Failed” path.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: a647304f-cf0c-4ce9-8047-0dfa86e8d330
📒 Files selected for processing (4)
bundles/com.espressif.idf.core/src/com/espressif/idf/core/tools/util/ToolsUtility.javabundles/com.espressif.idf.ui/src/com/espressif/idf/ui/tools/Messages.javabundles/com.espressif.idf.ui/src/com/espressif/idf/ui/tools/manager/pages/ESPIDFMainTablePage.javabundles/com.espressif.idf.ui/src/com/espressif/idf/ui/tools/messages.properties
| if (line.startsWith("ESP_IDF_VERSION=") && line.split("=").length >= 2) //$NON-NLS-1$ //$NON-NLS-2$ | ||
| { | ||
| espIdfVersion = line.split("=")[1]; //$NON-NLS-1$ | ||
| espIdfVersion = line.split("=")[1].trim(); //$NON-NLS-1$ | ||
| break; |
There was a problem hiding this comment.
Handle quoted-empty version values before returning.
On Line 53, ESP_IDF_VERSION="" is parsed as "" (non-empty text), so the UI empty check won’t trigger the “Detection Failed” path. This misses the PR’s target scenario.
Proposed fix
- if (line.startsWith("ESP_IDF_VERSION=") && line.split("=").length >= 2) //$NON-NLS-1$ //$NON-NLS-2$
+ if (line.startsWith("ESP_IDF_VERSION=")) //$NON-NLS-1$
{
- espIdfVersion = line.split("=")[1].trim(); //$NON-NLS-1$
+ String parsed = line.substring("ESP_IDF_VERSION=".length()).trim(); //$NON-NLS-1$
+ if (parsed.length() >= 2
+ && ((parsed.startsWith("\"") && parsed.endsWith("\"")) //$NON-NLS-1$ //$NON-NLS-2$
+ || (parsed.startsWith("'") && parsed.endsWith("'")))) //$NON-NLS-1$ //$NON-NLS-2$
+ {
+ parsed = parsed.substring(1, parsed.length() - 1).trim();
+ }
+ espIdfVersion = parsed;
break;
}🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In
`@bundles/com.espressif.idf.core/src/com/espressif/idf/core/tools/util/ToolsUtility.java`
around lines 51 - 54, The current parsing sets espIdfVersion =
line.split("=")[1].trim() which leaves quoted-empty values like "" as non-empty;
update the parsing in ToolsUtility.java (the block that checks
line.startsWith("ESP_IDF_VERSION=") and assigns espIdfVersion) to strip
surrounding double quotes (if present) and treat the result as empty when it
becomes an empty string (e.g., remove leading/trailing '"' after trim or check
for a literal "\"\"" and set espIdfVersion to null/empty), so downstream UI
empty checks correctly trigger the “Detection Failed” path.
|
@sigmaaa hi LGTM 👍 |
Description
If ESP-IDF was installed via an older version of EIM, the activation script could, in some cases, return ESP_IDF_VERSION="", which causes an error on the IDE side. The goal of this PR is to make the check more robust and provide feedback to the user if this happens.
Fixes # (IEP-1694)
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
New Features
Bug Fixes