Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 21, 2025

The CLI wasn't handling untitled file references when attached as context, unlike the cloud sessions provider which reads and embeds their content.

Changes

  • Separated untitled file handling in constructChatVariablesAndAttachments() to detect scheme === 'untitled' references
  • Added extractUntitledFileContent() method to read untitled file content via vscode.workspace.openTextDocument() and wrap with <file-start>/<file-end> tags
  • Updated resolvePrompt() to append untitled file context to the generated prompt
  • Used dynamic import import('vscode') to satisfy ESLint restrictions (src/**/node/**/* paths cannot use runtime vscode imports)

Pattern

Matches copilotCloudSessionsProvider.ts (lines 978-989) implementation:

// Untitled files are now embedded in prompt context:
// The user has attached the following untitled files as relevant context:
// <file-start>/Untitled-1</file-start>
// [file content]
// <file-end>/Untitled-1</file-end>
Original prompt

for the CLI - copy how the cloud sessions attached file references. We need the CLI to get the untitled file

The user has attached the following file paths as relevant context:

  • src/extension/chatSessions/vscode-node/copilotCloudSessionsProvider.ts
  • .github/copilot-instructions.md

Created from VS Code.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: joshspicer <23246594+joshspicer@users.noreply.github.com>
Copilot AI changed the title [WIP] Add CLI functionality to get untitled file references Add untitled file support to Copilot CLI prompt resolver Nov 22, 2025
Copilot AI requested a review from joshspicer November 22, 2025 00:06
Copilot finished work on behalf of joshspicer November 22, 2025 00:06
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.

2 participants