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

Method highlight_constant

src/highlight/mod.rs:319–340  ·  view source on GitHub ↗

Highlight all occurrences of a constant name.

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

Source from the content-addressed store, hash-verified

317
318 /// Highlight all occurrences of a constant name.
319 fn highlight_constant(
320 &self,
321 symbol_map: &SymbolMap,
322 content: &str,
323 target_name: &str,
324 ) -> Vec<DocumentHighlight> {
325 let mut highlights = Vec::new();
326
327 for span in &symbol_map.spans {
328 if let SymbolKind::ConstantReference { name } = &span.kind
329 && name == target_name
330 {
331 highlights.push(DocumentHighlight {
332 range: byte_range_to_lsp_range(content, span.start as usize, span.end as usize),
333 kind: Some(DocumentHighlightKind::READ),
334 });
335 }
336 }
337
338 highlights.sort_by(cmp_highlight_range);
339 highlights
340 }
341
342 /// Highlight all occurrences of `self`, `static`, or `parent` within
343 /// the same class body.

Callers 1

Calls 2

byte_range_to_lsp_rangeFunction · 0.85
pushMethod · 0.80

Tested by

no test coverage detected