MCPcopy Create free account
hub / github.com/PHPantom-dev/phpantom_lsp / build_new_insert

Method build_new_insert

src/completion/context/class_completion.rs:1402–1414  ·  view source on GitHub ↗

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]>,
    )

Source from the content-addressed store, hash-verified

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 ///

Callers

nothing calls this directly

Calls 2

build_callable_snippetFunction · 0.85
is_emptyMethod · 0.45

Tested by

no test coverage detected