Repository navigation
Refresh conversation templates dynamically on workspace project changes - #431
Daniel Belina (dmbelina) wants to merge 3 commits into
Conversation
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.
|
@microsoft-github-policy-service agree [company="IBM"] |
|
@microsoft-github-policy-service agree company="IBM" |
fd85628 to
d35212a
Compare
|
Fixes #446 |
There was a problem hiding this comment.
🟡 Changes recommended
The new project-change refresh path lacks tests covering add/open/close/remove deltas and refresh behavior, leaving a regression that could keep templates stale undetected.
1 open issue
2 resolved since last review
Review effort: Lite
| this.resourceChangeListener = event -> { | ||
| if (event.getType() == IResourceChangeEvent.POST_CHANGE && hasProjectChanges(event.getDelta())) { | ||
| fetchAsync(); |


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