Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions packages/vscode-extension/src/project/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ import {
import { AdminRestrictedFunctionalityError, PaywalledFunctionalityError } from "../common/Errors";
import { Sentiment } from "../common/types";
import { FeedbackGenerator } from "./feedbackGenerator";
import { EditorType, getEditorType } from "../utilities/editorType";

const DEEP_LINKS_HISTORY_KEY = "deep_links_history";

Expand Down Expand Up @@ -794,9 +795,19 @@ export class Project implements Disposable, ProjectInterface, DeviceSessionsMana

addToChatContext(...filePaths: string[]): void {
try {
commands.executeCommand("copilot-chat.focus").then(async () => {
const editor = getEditorType();

let focusCommand = "copilot-chat.focus";
let attachFileCommand = "workbench.action.chat.attachFile";

if (editor === EditorType.CURSOR) {
focusCommand = "composer.startComposerPrompt";
attachFileCommand = "composer.addfilestocomposer";
}

commands.executeCommand(focusCommand).then(async () => {
for (const filePath of filePaths) {
await commands.executeCommand("workbench.action.chat.attachFile", Uri.file(filePath));
await commands.executeCommand(attachFileCommand, Uri.file(filePath));
}
});
} catch (e) {
Expand Down
Loading