Skip to content

Commit 2d4364d

Browse files
committed
feat:支持多个文件SendToChat
1 parent ead8320 commit 2d4364d

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

src/extension.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -398,10 +398,12 @@ export function activate(context: vscode.ExtensionContext) {
398398
}
399399
});
400400

401-
let sendFileToChatCommand = vscode.commands.registerCommand('codeReDesign.sendToChat', async (uri: vscode.Uri) => {
402-
if (uri && uri.scheme === 'file') {
403-
ChatPanel.insertFilePathToInput(context, uri.fsPath);
401+
let sendFileToChatCommand = vscode.commands.registerCommand('codeReDesign.sendToChat', async (uri: vscode.Uri, alluri: vscode.Uri[]) => {
402+
for (const singleUri of alluri) {
403+
if (singleUri && singleUri.scheme === 'file') {
404+
ChatPanel.insertFilePathToInput(context, singleUri.fsPath);
404405
}
406+
}
405407
});
406408

407409
context.subscriptions.push(generateCvbCommand, redesignCvbCommand, applyCvbCommand, stopOperation, analyzeCodeCommand, startChatCommand, packupToCvbCommand, sendFileToChatCommand);

src/siderBar.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,15 @@ export function registerCvbContextMenu(context: vscode.ExtensionContext) {
8282
});
8383
context.subscriptions.push(summaryCvbCommand);
8484

85-
const sendToChatommand = vscode.commands.registerCommand('codeReDesign.sendThisToChat', async (cvb: CvbFile) => {
86-
const filePath = cvb.resourceUri?.fsPath || "";
87-
await sendToChat(context, filePath);
85+
const sendToChatCommand = vscode.commands.registerCommand('codeReDesign.sendThisToChat', async (cvb: CvbFile, cvbs: CvbFile[]) => {
86+
for (const item of cvbs) {
87+
const filePath = item.resourceUri?.fsPath || "";
88+
if (filePath) {
89+
await sendToChat(context, filePath);
90+
}
91+
}
8892
});
89-
context.subscriptions.push(sendToChatommand);
93+
context.subscriptions.push(sendToChatCommand);
9094

9195
const analyzeSingleFileCommand = vscode.commands.registerCommand('codeReDesign.analyzeSingleFile', async (uri: vscode.Uri) => {
9296
const filePath = uri.fsPath || "";

0 commit comments

Comments
 (0)