Skip to content
This repository was archived by the owner on May 20, 2026. It is now read-only.

Add untitled file support to Copilot CLI prompt resolver#2145

Draft
Copilot wants to merge 2 commits into
mainfrom
copilot/get-untitled-file-from-cli
Draft

Add untitled file support to Copilot CLI prompt resolver#2145
Copilot wants to merge 2 commits into
mainfrom
copilot/get-untitled-file-from-cli

Conversation

Copy link
Copy Markdown
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
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants