Skip to content

Conversation

@DonJayamanne
Copy link
Collaborator

No description provided.

@DonJayamanne DonJayamanne self-assigned this Nov 28, 2025
const documentText = this.workspaceService.textDocuments.find(doc => isEqual(doc.uri, fileUri))?.getText();
let content = documentText ?? new TextDecoder().decode(await this.fileSystemService.readFile(fileUri));
const doc = await this.workspaceService.openTextDocument(fileUri);
let content = doc.getText();
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@aeschli /cc

@DonJayamanne DonJayamanne requested a review from Copilot November 28, 2025 14:28
Copilot finished reviewing on behalf of DonJayamanne November 28, 2025 14:31
@DonJayamanne DonJayamanne marked this pull request as ready for review November 28, 2025 14:31
Copy link
Contributor

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 refactors prompt file reading operations to use VS Code's text document API (IWorkspaceService.openTextDocument()) instead of directly reading files with IFileSystemService.readFile(). This change provides better integration with VS Code's document management system, including caching and change tracking capabilities.

Key Changes

  • Updated PromptsServiceImpl to use IWorkspaceService instead of IFileSystemService for reading prompt files
  • Improved cancellation handling using raceCancellationError() utility
  • Updated CopilotCLIChatSessionParticipant to use the new IPromptsService API and properly thread cancellation tokens through method calls

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/platform/promptFiles/common/promptsServiceImpl.ts Replaced file system reading with workspace text document API and improved cancellation handling
src/platform/promptFiles/common/promptsService.ts Added _serviceBrand property to interface for proper service typing
src/extension/prompts/node/panel/promptFile.tsx Updated to use openTextDocument() instead of finding or reading documents directly, removed unused imports
src/extension/chatSessions/vscode-node/copilotCLIChatSessionsContribution.ts Refactored to use IPromptsService for parsing prompt files and added cancellation token parameter to relevant methods
src/extension/chatSessions/vscode-node/test/copilotCLIChatSessionParticipant.spec.ts Updated test to instantiate PromptsServiceImpl with required IWorkspaceService dependency

@vs-code-engineering vs-code-engineering bot added this to the November 2025 milestone Nov 28, 2025
@DonJayamanne DonJayamanne added this pull request to the merge queue Dec 1, 2025
Merged via the queue into main with commit 5d18692 Dec 1, 2025
22 checks passed
@DonJayamanne DonJayamanne deleted the don/visible-capybara branch December 1, 2025 02:34
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