File tree Expand file tree Collapse file tree 2 files changed +24
-23
lines changed
Expand file tree Collapse file tree 2 files changed +24
-23
lines changed Original file line number Diff line number Diff line change @@ -292,4 +292,28 @@ impl Transaction<'_> {
292292 }
293293 has_added_any
294294 }
295+
296+ /// Adds literal completions for function call arguments based on parameter types.
297+ pub ( crate ) fn add_literal_completions (
298+ & self ,
299+ handle : & Handle ,
300+ position : TextSize ,
301+ completions : & mut Vec < CompletionItem > ,
302+ in_string_literal : bool ,
303+ ) {
304+ if let Some ( ( callables, chosen_overload_index, active_argument, _) ) =
305+ self . get_callables_from_call ( handle, position)
306+ && let Some ( callable) = callables. get ( chosen_overload_index)
307+ && let Some ( params) =
308+ Self :: normalize_singleton_function_type_into_params ( callable. clone ( ) )
309+ && let Some ( arg_index) = Self :: active_parameter_index ( & params, & active_argument)
310+ && let Some ( param) = params. get ( arg_index)
311+ {
312+ Self :: add_literal_completions_from_type (
313+ param. as_type ( ) ,
314+ completions,
315+ in_string_literal,
316+ ) ;
317+ }
318+ }
295319}
Original file line number Diff line number Diff line change @@ -2695,29 +2695,6 @@ impl<'a> Transaction<'a> {
26952695 }
26962696 }
26972697
2698- fn add_literal_completions (
2699- & self ,
2700- handle : & Handle ,
2701- position : TextSize ,
2702- completions : & mut Vec < CompletionItem > ,
2703- in_string_literal : bool ,
2704- ) {
2705- if let Some ( ( callables, chosen_overload_index, active_argument, _) ) =
2706- self . get_callables_from_call ( handle, position)
2707- && let Some ( callable) = callables. get ( chosen_overload_index)
2708- && let Some ( params) =
2709- Self :: normalize_singleton_function_type_into_params ( callable. clone ( ) )
2710- && let Some ( arg_index) = Self :: active_parameter_index ( & params, & active_argument)
2711- && let Some ( param) = params. get ( arg_index)
2712- {
2713- Self :: add_literal_completions_from_type (
2714- param. as_type ( ) ,
2715- completions,
2716- in_string_literal,
2717- ) ;
2718- }
2719- }
2720-
27212698 // Kept for backwards compatibility - used by external callers (lsp/server.rs, playground.rs)
27222699 // who don't need the is_incomplete flag
27232700 pub fn completion (
You can’t perform that action at this time.
0 commit comments