Build the insert text (and optional format) for a `new` context class name completion. If constructor parameters are available, generates a callable snippet; otherwise generates `Name()$0`.
(
name: &str,
ctor_params: Option<&[ParameterInfo]>,
)
| 1400 | /// If constructor parameters are available, generates a callable |
| 1401 | /// snippet; otherwise generates `Name()$0`. |
| 1402 | pub(in crate::completion) fn build_new_insert( |
| 1403 | name: &str, |
| 1404 | ctor_params: Option<&[ParameterInfo]>, |
| 1405 | ) -> (String, Option<InsertTextFormat>) { |
| 1406 | if let Some(params) = ctor_params |
| 1407 | && !params.is_empty() |
| 1408 | { |
| 1409 | let snippet = build_callable_snippet(name, params); |
| 1410 | (snippet, Some(InsertTextFormat::SNIPPET)) |
| 1411 | } else { |
| 1412 | (format!("{name}()$0"), Some(InsertTextFormat::SNIPPET)) |
| 1413 | } |
| 1414 | } |
| 1415 | |
| 1416 | /// Load the `__construct` parameters for a class, if available. |
| 1417 | /// |
nothing calls this directly
no test coverage detected