File tree Expand file tree Collapse file tree 3 files changed +9
-7
lines changed
Expand file tree Collapse file tree 3 files changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -473,15 +473,17 @@ export class ChatPanel {
473473 return conversation ;
474474 }
475475
476- public static insertFilePathToInput ( filePath : string ) : void {
476+ public static insertFilePathToInput ( context : vscode . ExtensionContext , filePath : string ) : void {
477+ if ( ! ChatPanel . currentPanel ) {
478+ ChatPanel . createOrShow ( context ) ;
479+ }
480+
477481 if ( ChatPanel . currentPanel ) {
478482 const formattedPath = `@file:${ filePath } ` ;
479483 ChatPanel . currentPanel . panel . webview . postMessage ( {
480484 command : 'insertFilePath' ,
481485 content : formattedPath
482486 } ) ;
483- } else {
484- vscode . window . showInformationMessage ( 'No active chat panel. Please open a chat panel first.' ) ;
485487 }
486488 }
487489
Original file line number Diff line number Diff line change @@ -400,7 +400,7 @@ export function activate(context: vscode.ExtensionContext) {
400400
401401 let sendFileToChatCommand = vscode . commands . registerCommand ( 'codeReDesign.sendToChat' , async ( uri : vscode . Uri ) => {
402402 if ( uri && uri . scheme === 'file' ) {
403- ChatPanel . insertFilePathToInput ( uri . fsPath ) ;
403+ ChatPanel . insertFilePathToInput ( context , uri . fsPath ) ;
404404 }
405405 } ) ;
406406
Original file line number Diff line number Diff line change @@ -84,7 +84,7 @@ export function registerCvbContextMenu(context: vscode.ExtensionContext) {
8484
8585 const sendToChatommand = vscode . commands . registerCommand ( 'codeReDesign.sendThisToChat' , async ( cvb : CvbFile ) => {
8686 const filePath = cvb . resourceUri ?. fsPath || "" ;
87- await sendToChat ( filePath ) ;
87+ await sendToChat ( context , filePath ) ;
8888 } ) ;
8989 context . subscriptions . push ( sendToChatommand ) ;
9090
@@ -463,6 +463,6 @@ async function summaryThisCvb(filePath: string) {
463463 vscode . window . showInformationMessage ( `Conversation log saved as: ${ filePath } ` ) ;
464464}
465465
466- async function sendToChat ( filePath : string ) {
467- ChatPanel . insertFilePathToInput ( filePath ) ;
466+ async function sendToChat ( context : vscode . ExtensionContext , filePath : string ) {
467+ ChatPanel . insertFilePathToInput ( context , filePath ) ;
468468}
You can’t perform that action at this time.
0 commit comments