@@ -63,9 +63,7 @@ const PromptsTab = ({
6363 clearCompletions ( ) ;
6464 } , [ clearCompletions , selectedPrompt ] ) ;
6565
66- const handleInputChange = async ( argName : string , value : string ) => {
67- setPromptArgs ( ( prev ) => ( { ...prev , [ argName ] : value } ) ) ;
68-
66+ const triggerCompletions = ( argName : string , value : string ) => {
6967 if ( selectedPrompt ) {
7068 requestCompletions (
7169 {
@@ -79,6 +77,16 @@ const PromptsTab = ({
7977 }
8078 } ;
8179
80+ const handleInputChange = async ( argName : string , value : string ) => {
81+ setPromptArgs ( ( prev ) => ( { ...prev , [ argName ] : value } ) ) ;
82+ triggerCompletions ( argName , value ) ;
83+ } ;
84+
85+ const handleFocus = async ( argName : string ) => {
86+ const currentValue = promptArgs [ argName ] || "" ;
87+ triggerCompletions ( argName , currentValue ) ;
88+ } ;
89+
8290 const handleGetPrompt = ( ) => {
8391 if ( selectedPrompt ) {
8492 getPrompt ( selectedPrompt . name , promptArgs ) ;
@@ -143,6 +151,7 @@ const PromptsTab = ({
143151 onInputChange = { ( value ) =>
144152 handleInputChange ( arg . name , value )
145153 }
154+ onFocus = { ( ) => handleFocus ( arg . name ) }
146155 options = { completions [ arg . name ] || [ ] }
147156 />
148157
0 commit comments