Commit efcdc66
authored
fix: refresh Test Explorer after first-time enable tests (#1870)
When the Test Explorer has no resolved projects yet and a
`classpathUpdated` notification arrives (the exact scenario after
"Java: Enable Tests" downloads a JUnit jar onto an unmanaged folder),
`refreshProject` would iterate over zero items, match nothing and
silently return, leaving the user to manually refresh.
Root cause traced end-to-end via JDT-LS `.metadata/.log` and the
LSP wire trace (`java.trace.server: verbose`):
1. jar lands in `lib/`
2. JDT-LS file watcher -> `UpdateClasspathJob` -> classpath delta
(`>> Updating classpath` / `>> Adding <jar>`, both fire ~10x)
3. `ClasspathUpdateHandler` sends
`language/eventNotification { eventType: 100, data: <ws-uri> }`
4. vscode-java fires `onDidClasspathUpdate(uri)`
5. vscode-java-test calls `refreshProject(uri)`
6. BUG: `testController.items.size === 0` -> no match -> silent return
Fix the bootstrap case by falling back to a full `refreshExplorer()`
when there are no roots to match against, while keeping the existing
"skip unrelated classpath updates" behaviour intact for the common
case where there ARE roots but the URI matches none of them (e.g.
sibling non-test projects like Gradle's `buildSrc`).1 parent 6133b3f commit efcdc66
1 file changed
Lines changed: 4 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
104 | | - | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
105 | 108 | | |
106 | 109 | | |
107 | 110 | | |
| |||
0 commit comments