Fix prompt and skills discovery at workspace root level#269
Conversation
|
@Arexoor please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.
Contributor License AgreementContribution License AgreementThis Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
|
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
This PR updates workspace folder discovery for chat completion template initialization by using a shared utility, adding workspace-root inclusion, and logging discovered folders to help debug prompt/skill discovery.
Changes:
- Replace
LSPEclipseUtils.getWorkspaceFolders()withWorkspaceUtils.listWorkspaceFolders() - Add info-level logging of discovered workspace folders during template initialization
- Enhance workspace folder listing to include the workspace root and de-duplicate folder URIs
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/chat/services/ChatCompletionService.java | Switches folder discovery to WorkspaceUtils and logs discovered folders before requesting templates. |
| com.microsoft.copilot.eclipse.core/src/com/microsoft/copilot/eclipse/core/utils/WorkspaceUtils.java | Adds workspace-root to workspace folders and de-duplicates by URI. |
| List<WorkspaceFolder> workspaceFolders = WorkspaceUtils.listWorkspaceFolders(); | ||
| // Log workspace folders for debugging prompt/skill discovery | ||
| if (!workspaceFolders.isEmpty()) { | ||
| StringBuilder folderLog = new StringBuilder("Discovering prompts and skills from workspace folders: "); | ||
| for (WorkspaceFolder folder : workspaceFolders) { | ||
| folderLog.append("[").append(folder.getName()).append(": ").append(folder.getUri()).append("] "); | ||
| } | ||
| CopilotCore.LOGGER.info(folderLog.toString()); | ||
| } else { | ||
| CopilotCore.LOGGER.info("No workspace folders available for prompt and skill discovery"); | ||
| } |
| try { | ||
| URI workspaceRootUri = ResourcesPlugin.getWorkspace().getRoot().getLocationURI(); | ||
| if (workspaceRootUri != null) { | ||
| String rootUriString = workspaceRootUri.toASCIIString(); | ||
| WorkspaceFolder rootFolder = new WorkspaceFolder(); | ||
| rootFolder.setUri(rootUriString); | ||
| rootFolder.setName("workspace-root"); | ||
| folders.add(rootFolder); | ||
| seenUris.add(rootUriString); | ||
| } | ||
| } catch (Exception e) { | ||
| // If we can't get workspace root URI, continue with projects only | ||
| } |
| List<IProject> projects = WorkspaceUtils.listTopLevelProjects(); | ||
|
|
||
| List<WorkspaceFolder> folders = new ArrayList<>(); | ||
| java.util.Set<String> seenUris = new java.util.HashSet<>(); |
| String rootUriString = workspaceRootUri.toASCIIString(); | ||
| WorkspaceFolder rootFolder = new WorkspaceFolder(); | ||
| rootFolder.setUri(rootUriString); | ||
| rootFolder.setName("workspace-root"); |
|
See also #143 for a more systematic problem we have. probably your fix need to be alighned with that? |
Fixes #245
This PR fixes the issue where prompts and skills files located at the workspace root directory (e.g., eclipse-workspace/.github) were not being discovered and loaded by the Copilot plugin with an SAP ADT projects.
Root Cause
The WorkspaceUtils.listWorkspaceFolders() method only returned top-level Eclipse projects in the workspace, but never included the workspace root directory itself. This meant that:
Solution
Modified WorkspaceUtils.listWorkspaceFolders() to:
Changes Made:
com.microsoft.copilot.eclipse.core/src/com/microsoft/copilot/eclipse/core/utils/WorkspaceUtils.javacom.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/chat/services/ChatCompletionService.java