Skip to content

fix: resolve bug where workspace projects are silently dropped [IDE-1083]#358

Merged
bastiandoetsch merged 4 commits intomainfrom
fix/IDE-1083_not-all-eclipse-projects-are-shown
Feb 9, 2026
Merged

fix: resolve bug where workspace projects are silently dropped [IDE-1083]#358
bastiandoetsch merged 4 commits intomainfrom
fix/IDE-1083_not-all-eclipse-projects-are-shown

Conversation

@bastiandoetsch
Copy link
Copy Markdown
Contributor

@bastiandoetsch bastiandoetsch commented Feb 6, 2026

User description

Description

Fixes IDE-1083 — Eclipse plugin only scans 1 of N projects in a workspace.

Root cause: The add boolean flag in ResourceUtils.getAccessibleTopLevelProjects() was declared outside the outer for loop and never reset to true at the start of each iteration. Once any project was identified as a sub-project (setting add = false), all subsequent independent projects were silently dropped from the workspace folders list sent to the language server.

Fix: Replace the outer-scoped boolean add with a properly scoped boolean isSubProject declared inside each loop iteration.

Additional: Diagnostic logging added at each filtering stage (not accessible, derived, hidden, sub-project deduplication) so that future issues with missing workspace projects can be diagnosed from LS logs without requiring customer log exchanges.

Checklist

Test scenarios

Test Scenario
testIndependentProjectsAreAllReturned 3 independent projects (mirrors customer setup) are all returned
testSubProjectIsFilteredOut Child project under a parent path is correctly excluded
testProjectAfterSubProjectIsNotDropped Regression test for the bug: independent project after a sub-project is not silently dropped
testInaccessibleProjectIsFiltered isAccessible() == false projects are excluded
testDerivedProjectIsFiltered isDerived() == true projects are excluded
testHiddenProjectIsFiltered isHidden() == true projects are excluded

PR Type

bug_fix, tests


Description

  • Fixes bug where workspace projects were silently dropped.

  • Introduces enhanced logging for project filtering.

  • Adds comprehensive unit tests for project filtering scenarios.


Diagram Walkthrough

flowchart LR
  A[Existing Project Filtering Logic] --> B(Bug: 'add' flag not reset);
  B --> C{Subsequent projects dropped};
  D[New Logic: 'isSubProject' flag] --> E{Correct project inclusion};
  F[Added Logging] --> G(Improved diagnostics);
  H[New Tests] --> I(Verified fixes and regressions);
Loading

File Walkthrough

Relevant files
Bug fix
ResourceUtils.java
Refactor project filtering logic and add logging                 

plugin/src/main/java/io/snyk/eclipse/plugin/utils/ResourceUtils.java

  • Replaced the add boolean flag with isSubProject for correct scope.
  • Added diagnostic logging for various project filtering stages.
  • Improved clarity of project filtering logic within
    getAccessibleTopLevelProjects.
+22/-4   
Tests
ResourceUtilsTest.java
Add comprehensive tests for project filtering                       

tests/src/test/java/io/snyk/eclipse/plugin/utils/ResourceUtilsTest.java

  • Added unit tests for scenarios including independent projects,
    sub-projects, inaccessible, derived, and hidden projects.
  • Included a regression test to ensure projects after a sub-project are
    not dropped.
  • Mocked Eclipse workspace and project objects for isolated testing.
+181/-0 

…083]

The `add` boolean in `getAccessibleTopLevelProjects()` was never reset to
`true` at the start of each loop iteration. Once any project was identified
as a sub-project (setting `add = false`), all subsequent independent projects
were silently dropped from the workspace folders list.

This caused only 1 of N projects to be scanned when a workspace contained
both parent/child projects and unrelated independent projects.

Additionally, diagnostic logging is added at each filtering stage (not
accessible, derived, hidden, sub-project) so that future issues with
missing workspace projects can be diagnosed from the logs.

Co-authored-by: Cursor <cursoragent@cursor.com>
@bastiandoetsch
Copy link
Copy Markdown
Contributor Author

/describe

@snyk-io
Copy link
Copy Markdown

snyk-io bot commented Feb 6, 2026

Snyk checks have passed. No issues have been found so far.

Status Scanner Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues
Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@snyk-pr-review-bot
Copy link
Copy Markdown

PR Description updated to latest commit (9115819)

for (IProject project : allProjects) {
var path = getFullPath(project);
if (!project.isAccessible()) {
SnykLogger.logInfo("Project filtered (not accessible): " + project.getName() + " path=" + path);

Check warning

Code scanning / PMD

The String literal " path=" appears 4 times in this file; the first occurrence is on line 82 Warning

The String literal " path=" appears 4 times in this file; the first occurrence is on line 82
Extract duplicate string literal " path=" to PATH_LOG_PREFIX constant
(AvoidDuplicateLiterals) and narrow catch block from Exception to
IOException (AvoidCatchingGenericException).

Co-authored-by: Cursor <cursoragent@cursor.com>
@bastiandoetsch bastiandoetsch marked this pull request as ready for review February 6, 2026 15:28
@bastiandoetsch bastiandoetsch requested review from a team as code owners February 6, 2026 15:28
@snyk-pr-review-bot

This comment has been minimized.

Add logDebug method to SnykLogger (IStatus.OK level) and switch all
diagnostic log messages in getAccessibleTopLevelProjects from logInfo
to logDebug to avoid noise in production logs.

Co-authored-by: Cursor <cursoragent@cursor.com>
@snyk-pr-review-bot

This comment has been minimized.

@snyk-pr-review-bot
Copy link
Copy Markdown

PR Reviewer Guide 🔍

🧪 PR contains tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Refine Exception Handling

The change from catch (Exception e) to catch (IOException e) at line 52 is a good step towards more specific exception handling. However, consider if openStream.transferTo(output) could throw other runtime exceptions (e.g., NullPointerException if output is null, though less likely with new ByteArrayOutputStream()). While IOException covers I/O errors, ensuring all potential exceptions are handled appropriately or documented is good practice. In this specific case, transferTo primarily throws IOException, so this change is likely sufficient.

} catch (IOException e) {
	SnykLogger.logError(e);
Diagnostic Log Consistency

The added diagnostic logging in getAccessibleTopLevelProjects() is very helpful. For consistency, consider adding the PATH_LOG_PREFIX to the log entry at line 85 and 87 as well, to align with the format used at line 89. This ensures a consistent output format for all project filtering logs. For example, SnykLogger.logInfo("Project filtered (derived): " + project.getName() + PATH_LOG_PREFIX + path);

	SnykLogger.logInfo("Project filtered (not accessible): " + project.getName() + PATH_LOG_PREFIX + path);
} else if (project.isDerived()) {
	SnykLogger.logInfo("Project filtered (derived): " + project.getName() + PATH_LOG_PREFIX + path);
} else if (project.isHidden()) {
	SnykLogger.logInfo("Project filtered (hidden): " + project.getName() + PATH_LOG_PREFIX + path);
}
📚 Repository Context Analyzed

This review considered 19 relevant code sections from 14 files (average relevance: 0.92)

@bastiandoetsch bastiandoetsch merged commit c295914 into main Feb 9, 2026
10 checks passed
@bastiandoetsch bastiandoetsch deleted the fix/IDE-1083_not-all-eclipse-projects-are-shown branch February 9, 2026 09: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.

3 participants