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

Method resolve_global_constant

src/completion/resolve.rs:293–310  ·  view source on GitHub ↗

Resolve a global constant (`define()` or stub constant).

(&self, item: &mut CompletionItem, data: &CompletionItemData)

Source from the content-addressed store, hash-verified

291
292 /// Resolve a global constant (`define()` or stub constant).
293 fn resolve_global_constant(&self, item: &mut CompletionItem, data: &CompletionItemData) {
294 let name = &data.member_name;
295
296 let lookup = self.lookup_global_constant(name);
297
298 let md = match &lookup {
299 Some(Some(val)) => format!("```php\n<?php\nconst {} = {};\n```", name, val),
300 Some(None) => format!("```php\n<?php\nconst {};\n```", name),
301 None => return,
302 };
303
304 // Fill in the inline detail (value hint next to the label).
305 if let Some(Some(val)) = &lookup {
306 item.detail = Some(val.clone());
307 }
308
309 set_documentation(item, md);
310 }
311}

Callers 1

Calls 3

set_documentationFunction · 0.85
cloneMethod · 0.80

Tested by

no test coverage detected