Highlight all occurrences of a standalone function name.
(
&self,
symbol_map: &SymbolMap,
content: &str,
target_name: &str,
)
| 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( |
no test coverage detected