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 @@ -15,6 +15,7 @@
import org.eclipse.launchbar.core.target.ILaunchTarget;

import com.espressif.idf.core.build.IDFLaunchConstants;
import com.espressif.idf.core.util.IDFUtil;
import com.espressif.idf.core.util.LaunchUtil;

public class IDFCoreLaunchConfigProvider extends CoreBuildGenericLaunchConfigProvider
Expand Down Expand Up @@ -77,7 +78,8 @@ public boolean launchConfigurationAdded(ILaunchConfiguration configuration) thro
@Override
public boolean launchConfigurationChanged(ILaunchConfiguration configuration) throws CoreException
{
// nothing to do
IDFUtil.updateProjectBuildFolder(configuration.getWorkingCopy());

return false;
}
Comment on lines 78 to 84
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

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Confirm listener fires for all configs and inspect ownsLaunchConfiguration semantics.
fd -e java ownsLaunchConfiguration -x rg -nP -C3 'ownsLaunchConfiguration' {}
rg -nP -C3 'launchConfigurationChanged' --type=java
rg -nP -C5 'getProject\s*\(\s*ILaunchConfiguration' --type=java

Repository: espressif/idf-eclipse-plugin

Length of output: 1112


🏁 Script executed:

# Get the full file to see method implementations
wc -l bundles/com.espressif.idf.launch.serial.core/src/com/espressif/idf/launch/serial/core/IDFCoreLaunchConfigProvider.java

Repository: espressif/idf-eclipse-plugin

Length of output: 194


🏁 Script executed:

# Read the full file with line numbers
cat -n bundles/com.espressif.idf.launch.serial.core/src/com/espressif/idf/launch/serial/core/IDFCoreLaunchConfigProvider.java

Repository: espressif/idf-eclipse-plugin

Length of output: 4398


🏁 Script executed:

# Find ownsLaunchConfiguration method definition
rg -nP 'ownsLaunchConfiguration' bundles/com.espressif.idf.launch.serial.core/src/ --type=java -B2 -A8

Repository: espressif/idf-eclipse-plugin

Length of output: 1670


🏁 Script executed:

# Find updateProjectBuildFolder implementation
rg -nP 'void updateProjectBuildFolder|updateProjectBuildFolder' bundles/com.espressif.idf.launch.serial.core/src/ --type=java -B2 -A10

Repository: espressif/idf-eclipse-plugin

Length of output: 2038


🏁 Script executed:

# Search for updateProjectBuildFolder across all bundles to find implementation
rg -nP 'updateProjectBuildFolder' --type=java -B2 -A12

Repository: espressif/idf-eclipse-plugin

Length of output: 10051


Add ownership check to gate unnecessary processing of foreign configuration types.

launchConfigurationChanged fires for every launch configuration change in the workspace. While the framework will call this method for all configuration types, this provider should only process configurations it owns—mirroring the pattern used in launchConfigurationAdded (line 75).

Although IDFUtil.updateProjectBuildFolder internally returns early if CoreBuildLaunchConfigDelegate.getProject(configuration) returns null (protecting against true "clobbering"), unconditional processing still wastes resources: each call allocates a working copy and performs attribute lookups even for unrelated configuration types.

Recommend early-returning for unowned configurations:

Proposed change
 	`@Override`
 	public boolean launchConfigurationChanged(ILaunchConfiguration configuration) throws CoreException
 	{
+		if (!ownsLaunchConfiguration(configuration))
+		{
+			return false;
+		}
 		IDFUtil.updateProjectBuildFolder(configuration.getWorkingCopy());
-
 		return false;
 	}
📝 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
@Override
public boolean launchConfigurationChanged(ILaunchConfiguration configuration) throws CoreException
{
// nothing to do
IDFUtil.updateProjectBuildFolder(configuration.getWorkingCopy());
return false;
}
`@Override`
public boolean launchConfigurationChanged(ILaunchConfiguration configuration) throws CoreException
{
if (!ownsLaunchConfiguration(configuration))
{
return false;
}
IDFUtil.updateProjectBuildFolder(configuration.getWorkingCopy());
return false;
}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@bundles/com.espressif.idf.launch.serial.core/src/com/espressif/idf/launch/serial/core/IDFCoreLaunchConfigProvider.java`
around lines 78 - 84, The method launchConfigurationChanged currently calls
IDFUtil.updateProjectBuildFolder unconditionally; add the same ownership guard
used in launchConfigurationAdded by early-returning when
CoreBuildLaunchConfigDelegate.getProject(configuration) is null so you only call
IDFUtil.updateProjectBuildFolder for configurations this provider owns, avoiding
unnecessary working-copy allocation and attribute lookups for foreign
configuration types.


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,29 +18,18 @@
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.debug.ui.AbstractLaunchConfigurationTabGroup;
import org.eclipse.debug.ui.ILaunchConfigurationDialog;

import com.espressif.idf.core.logging.Logger;
import com.espressif.idf.core.util.IDFUtil;

public class SerialFlashLaunchConfigTabGroup extends AbstractLaunchConfigurationTabGroup
{

@Override
public void createTabs(ILaunchConfigurationDialog dialog, String mode)
{

setTabs();

}

@Override
public void performApply(ILaunchConfigurationWorkingCopy configuration)
{
super.performApply(configuration);
IDFUtil.updateProjectBuildFolder(configuration);
}

@Override
Expand Down
Loading