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

Method highlight_function

src/highlight/mod.rs:295–316  ·  view source on GitHub ↗

Highlight all occurrences of a standalone function name.

(
        &self,
        symbol_map: &SymbolMap,
        content: &str,
        target_name: &str,
    )

Source from the content-addressed store, hash-verified

293
294 /// Highlight all occurrences of a standalone function name.
295 fn highlight_function(
296 &self,
297 symbol_map: &SymbolMap,
298 content: &str,
299 target_name: &str,
300 ) -> Vec<DocumentHighlight> {
301 let mut highlights = Vec::new();
302
303 for span in &symbol_map.spans {
304 if let SymbolKind::FunctionCall { name, .. } = &span.kind
305 && name == target_name
306 {
307 highlights.push(DocumentHighlight {
308 range: byte_range_to_lsp_range(content, span.start as usize, span.end as usize),
309 kind: Some(DocumentHighlightKind::READ),
310 });
311 }
312 }
313
314 highlights.sort_by(cmp_highlight_range);
315 highlights
316 }
317
318 /// Highlight all occurrences of a constant name.
319 fn highlight_constant(

Callers 1

Calls 2

byte_range_to_lsp_rangeFunction · 0.85
pushMethod · 0.80

Tested by

no test coverage detected