@@ -675,6 +675,21 @@ export const Chat = ({
675675 const selected = slashMatches [ index ]
676676 if ( ! selected ) return
677677
678+ // If the command has insertText, insert it instead of executing
679+ if ( selected . insertText && slashContext . startIndex >= 0 ) {
680+ const before = inputValue . slice ( 0 , slashContext . startIndex )
681+ const after = inputValue . slice (
682+ slashContext . startIndex + 1 + slashContext . query . length ,
683+ )
684+ setInputValue ( {
685+ text : before + selected . insertText + after ,
686+ cursorPosition : before . length + selected . insertText . length ,
687+ lastEditDueToNav : false ,
688+ } )
689+ setSlashSelectedIndex ( 0 )
690+ return
691+ }
692+
678693 // Execute the selected slash command immediately
679694 const commandString = `/${ selected . id } `
680695 setSlashSelectedIndex ( 0 )
@@ -684,6 +699,9 @@ export const Chat = ({
684699 } ,
685700 [
686701 slashMatches ,
702+ slashContext ,
703+ inputValue ,
704+ setInputValue ,
687705 setSlashSelectedIndex ,
688706 onSubmitPrompt ,
689707 agentMode ,
@@ -884,6 +902,21 @@ export const Chat = ({
884902 const selected = slashMatches [ slashSelectedIndex ] || slashMatches [ 0 ]
885903 if ( ! selected ) return
886904
905+ // If the command has insertText, insert it instead of executing
906+ if ( selected . insertText && slashContext . startIndex >= 0 ) {
907+ const before = inputValue . slice ( 0 , slashContext . startIndex )
908+ const after = inputValue . slice (
909+ slashContext . startIndex + 1 + slashContext . query . length ,
910+ )
911+ setInputValue ( {
912+ text : before + selected . insertText + after ,
913+ cursorPosition : before . length + selected . insertText . length ,
914+ lastEditDueToNav : false ,
915+ } )
916+ setSlashSelectedIndex ( 0 )
917+ return
918+ }
919+
887920 // Execute the selected slash command immediately
888921 const commandString = `/${ selected . id } `
889922 setSlashSelectedIndex ( 0 )
0 commit comments