Skip to content

fix: trigger UI except other lsp event#1844

Merged
chagong merged 2 commits intomainfrom
wenyt/fixui
Mar 4, 2026
Merged

fix: trigger UI except other lsp event#1844
chagong merged 2 commits intomainfrom
wenyt/fixui

Conversation

@wenytang-ms
Copy link
Contributor

Fix unnecessary full refresh of test explorer when classpath changes in non-test projects

When a Gradle multi-module project contains a buildSrc directory, the Java Language Server fires onDidClasspathUpdate events for all Java projects — including buildSrc, which has no test sources. Previously, refreshProject() used startsWith to match the incoming classpath URI against existing test controller items. When no match was found (as with buildSrc), it fell back to loadJavaProjects(), triggering a full refresh of the entire test explorer tree view. This caused the UI to flicker and reset unnecessarily.

@wenytang-ms
Copy link
Contributor Author

#1839

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adjusts how classpath-change events from the Java Language Server map to Test Explorer refreshes, avoiding unnecessary full refreshes (and UI flicker) when the event comes from non-test projects (e.g., buildSrc in Gradle multi-module workspaces).

Changes:

  • Improves project matching by selecting the most specific (longest) matching project root for a classpath URI.
  • Adds handling for “ancestor URI” updates (e.g., workspace root) by refreshing all affected child test projects.
  • Skips refreshing entirely when the classpath URI doesn’t correspond to any known test project, preventing a full explorer reload.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

@chagong chagong merged commit 0f1cc47 into main Mar 4, 2026
4 checks passed
@chagong chagong deleted the wenyt/fixui branch March 4, 2026 12:40
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