Skip to content

Simplify flow for feeding Q# and QASM instruction files to Copilot#3009

Open
joao-boechat wants to merge 6 commits intomainfrom
joaoboechat/fix-instructions-path-issue
Open

Simplify flow for feeding Q# and QASM instruction files to Copilot#3009
joao-boechat wants to merge 6 commits intomainfrom
joaoboechat/fix-instructions-path-issue

Conversation

@joao-boechat
Copy link
Contributor

@joao-boechat joao-boechat commented Mar 9, 2026

This PR addresses issue 2961 by making two key changes:

  • It leverages contributes.chatInstructions to provide Q# and QASM instructions to Copilot Chat. This ensures that the relevant language instructions are automatically retrieved whenever Copilot is used with Q# or QASM code.
  • It removes the legacy flow defined in vscode/src/gh-copilot/instructions.ts. As part of this change, a cleanup script is introduced and executed on extension activation to remove the old configurations and their persisted files from the user’s filesystem. Additional logging has been added to help track whether this cleanup is still being applied or if the migration has fully rolled out.

): Promise<void> {
const globalStateUri = context.globalStorageUri;
const userInvoked = trigger === "Command" || trigger === "Project";
const removedConfig = await removeOldCopilotInstructionsConfig(context);
Copy link
Contributor

Choose a reason for hiding this comment

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

Will this remove user's custom instruction files? Do users have a way of migrating their existing custom instructions with this mechanism?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This shouldn't be a problem given that these files were updated by us and we didn't expect the users to touch them (they were buried deep down in the filesystem). If users want to add custom instructions, they are able to use skills.

@minestarks, thoughts?

Copy link
Member

@minestarks minestarks Mar 10, 2026

Choose a reason for hiding this comment

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

This deletes files from our extension's global storage, which only we manage.

"chat-instructions",
);

for (const file of ["qsharp.instructions.md", "openqasm.instructions.md"]) {
Copy link
Member

Choose a reason for hiding this comment

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

Could you just use the recursive flag and blow away chat-instructions entirely?

await vscode.workspace.fs.delete(dir);
result = true;
} catch {
// directory doesn't exist or isn't empty
Copy link
Member

Choose a reason for hiding this comment

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

Log unexpected errors with log.warn , just so they don't go entirely unnoticed to us developers.

Co-authored-by: Mine Starks <16928427+minestarks@users.noreply.github.com>
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