Highlight all occurrences of a class/interface/trait/enum name (by FQN) in the file.
(
&self,
symbol_map: &SymbolMap,
content: &str,
target_fqn: &str,
use_map: &HashMap<String, String>,
namespace: &Option<String>,
)
| 198 | /// Highlight all occurrences of a class/interface/trait/enum name |
| 199 | /// (by FQN) in the file. |
| 200 | fn highlight_class( |
| 201 | &self, |
| 202 | symbol_map: &SymbolMap, |
| 203 | content: &str, |
| 204 | target_fqn: &str, |
| 205 | use_map: &HashMap<String, String>, |
| 206 | namespace: &Option<String>, |
| 207 | ) -> Vec<DocumentHighlight> { |
| 208 | let mut highlights = Vec::new(); |
| 209 | |
| 210 | for span in &symbol_map.spans { |
| 211 | let fqn = match &span.kind { |
| 212 | SymbolKind::ClassReference { name, is_fqn, .. } => { |
| 213 | if *is_fqn { |
| 214 | name.clone() |
| 215 | } else { |
| 216 | Self::resolve_to_fqn(name, use_map, namespace) |
| 217 | } |
| 218 | } |
| 219 | SymbolKind::ClassDeclaration { name } => build_fqn(name, namespace.as_deref()), |
| 220 | _ => continue, |
| 221 | }; |
| 222 | |
| 223 | if fqn == target_fqn { |
| 224 | highlights.push(DocumentHighlight { |
| 225 | range: byte_range_to_lsp_range(content, span.start as usize, span.end as usize), |
| 226 | kind: Some(DocumentHighlightKind::READ), |
| 227 | }); |
| 228 | } |
| 229 | } |
| 230 | |
| 231 | highlights.sort_by(cmp_highlight_range); |
| 232 | highlights |
| 233 | } |
| 234 | |
| 235 | /// Highlight all member accesses and declarations with the same name. |
| 236 | /// |
no test coverage detected