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

Function class_names_from_data

src/completion/builder.rs:710–718  ·  view source on GitHub ↗

Extract the class name(s) from a `CompletionItem`'s `data` field. Returns a pipe-separated string of all class names (primary + extras), e.g. `"Lamp|Faucet"`. Returns `None` when the data field is absent or cannot be deserialized.

(item: &CompletionItem)

Source from the content-addressed store, hash-verified

708/// extras), e.g. `"Lamp|Faucet"`. Returns `None` when the data
709/// field is absent or cannot be deserialized.
710fn class_names_from_data(item: &CompletionItem) -> Option<String> {
711 let data_value = item.data.as_ref()?;
712 let data: CompletionItemData = serde_json::from_value(data_value.clone()).ok()?;
713 let mut names = vec![display_class_name(&data.class_name).to_string()];
714 for extra in &data.extra_class_names {
715 names.push(display_class_name(extra).to_string());
716 }
717 Some(names.join("|"))
718}
719
720/// Partition and sort completion items by union membership.
721///

Callers 1

Calls 3

cloneMethod · 0.80
pushMethod · 0.80
display_class_nameFunction · 0.70

Tested by

no test coverage detected