Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,12 @@ public void updateClangdPath()
InstanceScope.INSTANCE.getNode(qualifier).put(ClangdMetadata.Predefined.clangdPath.identifer(), clangdPath);
}

public void updateQueryDriver()
{
String qualifier = configuration.qualifier();
InstanceScope.INSTANCE.getNode(qualifier).put(ClangdMetadata.Predefined.queryDriver.identifer(), "**"); //$NON-NLS-1$
}

public void updateCompileCommandsDir(String buildDir)
{
String qualifier = configuration.qualifier();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,10 @@ protected IStatus run(IProgressMonitor monitor)

toolSetConfigurationManager.export(idfToolSet);
console.println("Tools Activated");
new LspService().updateClangdPath();
LspService lspService = new LspService();
lspService.updateClangdPath();
lspService.updateQueryDriver();
console.println(Messages.ClangdPreferences_UpdatedMsg);
Comment on lines +99 to +102
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.

Preferences scopedPreferenceStore = InstanceScope.INSTANCE.getNode(UIPlugin.PLUGIN_ID);
scopedPreferenceStore.putBoolean(INSTALL_TOOLS_FLAG, true);
try
Expand Down Expand Up @@ -173,7 +176,7 @@ public void run()

private void setUpToolChainsAndTargets()
{
//Get current active idf
// Get current active idf
String idfPath = IDFUtil.getIDFPath();
List<String> targets = IDFTargetsReader.readTargetsFromEspIdf(idfPath).getAllTargetNames();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,10 @@ public class Messages extends NLS
public static String SbomCommandDialog_StatusCantBeNullErrorMsg;

public static String ToolsInstallationJobCompletedMessage;

public static String BugReportHandler_CompletedBugReportMsg;

public static String ClangdPreferences_UpdatedMsg;

static
{
// initialize resource bundle
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,5 @@ SbomCommandDialog_StatusCantBeNullErrorMsg=Operation status cannot be null. Plea
ToolsInstallationJobCompletedMessage=Tool installation has been successfully completed. To utilize specific tools, please use \"Set Active\" button


BugReportHandler_CompletedBugReportMsg=\n\n================================\nBug report completed. You can find the report at: %s \n=================================\n
BugReportHandler_CompletedBugReportMsg=\n\n================================\nBug report completed. You can find the report at: %s \n=================================\n
ClangdPreferences_UpdatedMsg=Clangd preferences updated: clangd path and query driver path have been set.
Loading