Refresh conversation templates dynamically on workspace project changes - #431
Open
Daniel Belina (dmbelina) wants to merge 1 commit into
Open
Refresh conversation templates dynamically on workspace project changes#431Daniel Belina (dmbelina) wants to merge 1 commit into
Daniel Belina (dmbelina) wants to merge 1 commit into
Conversation
Daniel Belina (dmbelina)
requested review from
Ethan Hou (ethanyhou),
Sheng Chen (jdneo) and
xinyi-gong
as code owners
August 28, 2026 18:24
Daniel Belina (dmbelina)
requested a review
from Zidong Lu (duzitong)
as a code owner
August 28, 2026 18:24
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the Eclipse UI-side chat completion/template refresh logic so slash commands, custom prompts, and skills refresh automatically as workspace projects are added/opened/closed/removed—without requiring an Eclipse restart.
Changes:
- Switched workspace-folder resolution from LSP4E’s startup snapshot (
LSPEclipseUtils.getWorkspaceFolders()) toWorkspaceUtils.listWorkspaceFolders()for up-to-date project state. - Added an
IResourceChangeListenerto trigger template refresh on workspace project changes, and unregistered it ondispose().
Suppressed comments (1)
com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/chat/services/ChatCompletionService.java:254
- The
IllegalStateExceptionduring listener removal is swallowed silently. Logging an info-level message helps diagnose unexpected shutdown/dispose ordering issues where the listener might not be removed as intended.
} catch (IllegalStateException e) {
// Workspace may not be available during shutdown
}
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+92
to
+103
| private boolean hasProjectChanges(IResourceDelta delta) { | ||
| if (delta == null) { | ||
| return false; | ||
| } | ||
| // If the delta is at the root level, check each child | ||
| for (IResourceDelta child : delta.getAffectedChildren()) { | ||
| if (child.getResource() instanceof IProject) { | ||
| return true; | ||
| } | ||
| } | ||
| return delta.getResource() instanceof IProject; | ||
| } |
Comment on lines
+86
to
+88
| } catch (IllegalStateException e) { | ||
| // Workspace may not be available in standalone headless unit test environments | ||
| } |
Author
|
@microsoft-github-policy-service agree [company="IBM"] |
Author
|
@microsoft-github-policy-service agree company="IBM" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently, when Eclipse starts with an empty workspace (or when projects are imported, opened, closed, or deleted during a session), conversation templates, including slash commands (/), custom prompts, and skills, do not update until Eclipse is completely restarted.
This change adds tracking so conversation templates refresh automatically upon workspace changes.
Root Cause
ChatCompletionServiceusedLSPEclipseUtils.getWorkspaceFolders(), which holds a stale startup snapshot from LSP4E.ChatCompletionServicehad noIResourceChangeListenerfor workspace project changes.Changes
LSPEclipseUtils.getWorkspaceFolders()withWorkspaceUtils.listWorkspaceFolders().IResourceChangeListenerinChatCompletionServiceto refresh conversation templates onIProjectchanges (POST_CHANGE).dispose().Testing
/completion list without restarting.Note: There is also an upstream language server issue where
conversation/templatesskips global skills whenworkspaceFoldersis empty; this fix ensures that as soon as a project is opened, templates refresh immediately. For reference that issue is here: github/copilot-language-server-release#51