Skip to content

Commit e0a33c4

Browse files
committed
fix chat opening in cursor
1 parent 2724a0e commit e0a33c4

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

packages/vscode-extension/src/project/project.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ import {
7272
import { AdminRestrictedFunctionalityError, PaywalledFunctionalityError } from "../common/Errors";
7373
import { Sentiment } from "../common/types";
7474
import { FeedbackGenerator } from "./feedbackGenerator";
75+
import { EditorType, getEditorType } from "../utilities/editorType";
7576

7677
const DEEP_LINKS_HISTORY_KEY = "deep_links_history";
7778

@@ -794,9 +795,19 @@ export class Project implements Disposable, ProjectInterface, DeviceSessionsMana
794795

795796
addToChatContext(...filePaths: string[]): void {
796797
try {
797-
commands.executeCommand("copilot-chat.focus").then(async () => {
798+
const editor = getEditorType();
799+
800+
let focusCommand = "copilot-chat.focus";
801+
let attachFileCommand = "workbench.action.chat.attachFile";
802+
803+
if (editor === EditorType.CURSOR) {
804+
focusCommand = "composer.startComposerPrompt";
805+
// attachFileCommand = "composer.startComposerPrompt";
806+
}
807+
808+
commands.executeCommand(focusCommand).then(async () => {
798809
for (const filePath of filePaths) {
799-
await commands.executeCommand("workbench.action.chat.attachFile", Uri.file(filePath));
810+
await commands.executeCommand(attachFileCommand, Uri.file(filePath));
800811
}
801812
});
802813
} catch (e) {

0 commit comments

Comments
 (0)