Skip to content

Conversation

@sigmaaa
Copy link
Collaborator

@sigmaaa sigmaaa commented Oct 6, 2025

Description

Updating the query driver's path after installing the tools

Fixes # (IEP-1639)

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)

How has this been tested?

modify query driver's path -> update tools -> verify that query driver's path is default

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

  • New Features

    • Automatically configures C/C++ language server settings by setting both the clangd path and query driver during tools activation.
    • Displays a confirmation message after preferences are updated to reassure users the setup completed.
  • Bug Fixes

    • Improved formatting of the bug report completion message for clearer presentation.

@coderabbitai
Copy link

coderabbitai bot commented Oct 6, 2025

Walkthrough

Adds LspService.updateQueryDriver() to set ClangdMetadata.Predefined.queryDriver to "**". Updates ToolsActivationJob.run() to call updateClangdPath() and updateQueryDriver(), and to show a new user message. Introduces a new Messages key/value (ClangdPreferences_UpdatedMsg) and adjusts an existing messages.properties entry.

Changes

Cohort / File(s) Summary
LSP Service preference update
bundles/com.espressif.idf.core/src/com/espressif/idf/core/util/LspService.java
Adds public method updateQueryDriver() that writes "**" to ClangdMetadata.Predefined.queryDriver for the current qualifier, mirroring updateClangdPath().
Tools activation flow
bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/tools/ToolsActivationJob.java
In run(), instantiates LspService, calls updateClangdPath() and updateQueryDriver(), and prints Messages.ClangdPreferences_UpdatedMsg; minor comment formatting.
UI messages/resources
bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/update/Messages.java, bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/update/messages.properties
Adds ClangdPreferences_UpdatedMsg key/field; updates BugReportHandler_CompletedBugReportMsg formatting.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant TAJ as ToolsActivationJob
  participant LSP as LspService
  participant Pref as Preferences Store

  TAJ->>LSP: new LspService()
  TAJ->>LSP: updateClangdPath()
  LSP->>Pref: set clangdPath (current qualifier)
  Pref-->>LSP: ok

  TAJ->>LSP: updateQueryDriver()
  LSP->>Pref: set queryDriver = "**" (current qualifier)
  Pref-->>LSP: ok

  TAJ->>TAJ: print(Messages.ClangdPreferences_UpdatedMsg)
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • AndriiFilippov
  • alirana01
  • kolipakakondal

Poem

I hop through prefs with careful cheer,
Set clangd’s paths both far and near;
Asterisks twinkle: query-driver’s two,
“**” now saved—a starry view!
Tools awake, the message sings,
Eclipse burrows gain new springs.
Thump-thump—onward, config wings! 🐇✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title succinctly captures the main change of the pull request by specifying the update of query drivers following tool installation, which aligns with the added updateQueryDriver method and its invocation in ToolsActivationJob. It is concise, clear, and directly reflects the purpose of the changes.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch IEP-1639

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

@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: 1

🧹 Nitpick comments (1)
bundles/com.espressif.idf.core/src/com/espressif/idf/core/util/LspService.java (1)

73-77: Verify the permissive query driver setting.

The method unconditionally sets the query driver to "**", which allows clangd to query all compilers in the PATH. While this provides maximum flexibility, it's a permissive setting that could potentially allow clangd to interact with any compiler, including potentially problematic ones.

Additionally, unlike updateClangdPath() (lines 61-71), this method lacks logging. Consider adding a log statement for consistency and debugging purposes.

Apply this diff to add logging:

 public void updateQueryDriver()
 {
 	String qualifier = configuration.qualifier();
 	InstanceScope.INSTANCE.getNode(qualifier).put(ClangdMetadata.Predefined.queryDriver.identifer(), "**"); //$NON-NLS-1$
+	Logger.log("Query driver set to '**' for qualifier: " + qualifier); //$NON-NLS-1$
 }
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 27c8acf and b59cbcd.

📒 Files selected for processing (4)
  • bundles/com.espressif.idf.core/src/com/espressif/idf/core/util/LspService.java (1 hunks)
  • bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/tools/ToolsActivationJob.java (2 hunks)
  • bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/update/Messages.java (1 hunks)
  • bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/update/messages.properties (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/tools/ToolsActivationJob.java (1)
bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/update/Messages.java (1)
  • Messages (9-89)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: build_macos
  • GitHub Check: build_windows
🔇 Additional comments (3)
bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/update/Messages.java (1)

78-78: LGTM!

The new message field follows the established naming convention and integrates properly with the NLS message framework.

bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/tools/ToolsActivationJob.java (1)

179-179: LGTM!

Minor formatting improvement to the comment.

bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/update/messages.properties (1)

71-71: LGTM!

The new message text clearly communicates that both the clangd path and query driver path have been updated.

Comment on lines +99 to +102
LspService lspService = new LspService();
lspService.updateClangdPath();
lspService.updateQueryDriver();
console.println(Messages.ClangdPreferences_UpdatedMsg);
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Success message may be misleading if clangd path update fails.

The code prints Messages.ClangdPreferences_UpdatedMsg unconditionally after calling updateClangdPath() and updateQueryDriver(). However, updateClangdPath() can fail silently if clangd is not found in the build environment (see LspService.java lines 64-67), while updateQueryDriver() always succeeds.

The success message states "clangd path and query driver path have been set" but may not be accurate if clangd was not found.

Consider checking the result or handling the case where clangd path update might fail:

 LspService lspService = new LspService();
 lspService.updateClangdPath();
 lspService.updateQueryDriver();
-console.println(Messages.ClangdPreferences_UpdatedMsg);
+// Note: updateClangdPath() logs internally if clangd not found
+console.println(Messages.ClangdPreferences_UpdatedMsg);

Alternatively, modify LspService.updateClangdPath() to return a boolean indicating success, and adjust the message accordingly.

📝 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
LspService lspService = new LspService();
lspService.updateClangdPath();
lspService.updateQueryDriver();
console.println(Messages.ClangdPreferences_UpdatedMsg);
LspService lspService = new LspService();
lspService.updateClangdPath();
lspService.updateQueryDriver();
// Note: updateClangdPath() logs internally if clangd not found
console.println(Messages.ClangdPreferences_UpdatedMsg);
🤖 Prompt for AI Agents
In
bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/tools/ToolsActivationJob.java
around lines 99-102, the code prints a success message unconditionally even
though LspService.updateClangdPath() can fail silently; change the flow so you
detect whether the clangd path update succeeded (either by making
updateClangdPath() return a boolean or by adding a new LspService method like
isClangdConfigured()/getClangdPath() to check result), call that after
updateClangdPath(), and print the original success message only when clangd was
found/updated; otherwise print or log a different warning/error message
indicating clangd was not located while still updating query driver normally.

Copy link
Collaborator

@kolipakakondal kolipakakondal left a comment

Choose a reason for hiding this comment

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

LGTM

@kolipakakondal
Copy link
Collaborator

@AndriiFilippov Please verify

@kolipakakondal kolipakakondal added this to the v3.7.0 milestone Oct 9, 2025
@AndriiFilippov
Copy link
Collaborator

@sigmaaa @kolipakakondal hi

Tested under:
OS - Windows 11 / Linux Ubuntu / Mac arm64
ESP-IDF: v5.5.1

do see drivers and clangd path updated to the correct one after tools installation ✅
Also verified on Eclipse 25-09 ✅

LGMT 👍

@kolipakakondal kolipakakondal merged commit 8618c29 into master Oct 9, 2025
5 of 7 checks passed
@kolipakakondal kolipakakondal deleted the IEP-1639 branch October 9, 2025 11:55
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.

4 participants