@@ -19,7 +19,6 @@ import {
1919 map_raw_pos_to_display_pos
2020} from './utils/position-mapping'
2121import { dictionary } from '@shared/constants/dictionary'
22- import { get_file_match_hint_data } from './utils/get-file-match-hint-data'
2322
2423const Tooltip : React . FC < {
2524 message : string
@@ -83,12 +82,6 @@ export const PromptField: React.FC<PromptFieldProps> = (props) => {
8382 const [ show_submit_tooltip , set_show_submit_tooltip ] = useState ( false )
8483 const [ is_text_selecting , set_is_text_selecting ] = useState ( false )
8584 const [ is_focused , set_is_focused ] = useState ( false )
86- const [ show_file_match_hint , set_show_file_match_hint ] = useState ( false )
87- const file_match_hint_timer_ref = useRef < ReturnType <
88- typeof setTimeout
89- > | null > ( null )
90- const has_shown_hint_once_ref = useRef ( false )
91- const last_matching_word_ref = useRef < string | null > ( null )
9285
9386 const is_narrow_viewport = use_is_narrow_viewport ( 268 )
9487 const {
@@ -157,48 +150,6 @@ export const PromptField: React.FC<PromptFieldProps> = (props) => {
157150 return get_display_text ( props . value , props . context_file_paths ?? [ ] )
158151 } , [ props . value , props . context_file_paths ] )
159152
160- const should_show_hint = useMemo ( ( ) => {
161- const hint_data = get_file_match_hint_data (
162- display_text ,
163- caret_position ,
164- props . context_file_paths
165- )
166- return hint_data ? hint_data . word : false
167- } , [ display_text , caret_position , props . context_file_paths ] )
168-
169- useEffect ( ( ) => {
170- if ( file_match_hint_timer_ref . current ) {
171- clearTimeout ( file_match_hint_timer_ref . current )
172- file_match_hint_timer_ref . current = null
173- }
174-
175- if ( should_show_hint ) {
176- const matching_word = should_show_hint as string
177- const is_same_word = matching_word === last_matching_word_ref . current
178- if ( has_shown_hint_once_ref . current && is_same_word ) {
179- set_show_file_match_hint ( true )
180- } else {
181- file_match_hint_timer_ref . current = setTimeout ( ( ) => {
182- set_show_file_match_hint ( true )
183- has_shown_hint_once_ref . current = true
184- last_matching_word_ref . current = matching_word
185- } , 300 )
186- }
187- } else {
188- set_show_file_match_hint ( false )
189- if ( last_matching_word_ref . current !== null ) {
190- has_shown_hint_once_ref . current = false
191- last_matching_word_ref . current = null
192- }
193- }
194-
195- return ( ) => {
196- if ( file_match_hint_timer_ref . current ) {
197- clearTimeout ( file_match_hint_timer_ref . current )
198- }
199- }
200- } , [ should_show_hint ] )
201-
202153 const highlighted_html = useMemo ( ( ) => {
203154 return get_highlighted_text ( {
204155 text : props . value ,
@@ -375,7 +326,6 @@ export const PromptField: React.FC<PromptFieldProps> = (props) => {
375326 onFocus = { ( ) => set_is_focused ( true ) }
376327 onBlur = { ( ) => set_is_focused ( false ) }
377328 className = { cn ( styles . input , {
378- [ styles [ 'input-with-file-match-hint' ] ] : show_file_match_hint ,
379329 [ styles [ 'input--empty' ] ] : ! props . value
380330 } ) }
381331 data-placeholder = { placeholder }
0 commit comments