Resolve a global constant (`define()` or stub constant).
(&self, item: &mut CompletionItem, data: &CompletionItemData)
| 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 | } |
no test coverage detected