(method: &MethodInfo, content: &str)
| 203 | /// Convert a `MethodInfo` to a `DocumentSymbol`. |
| 204 | #[allow(deprecated)] |
| 205 | fn method_to_symbol(method: &MethodInfo, content: &str) -> Option<DocumentSymbol> { |
| 206 | if method.name_offset == 0 { |
| 207 | return None; |
| 208 | } |
| 209 | |
| 210 | let pos = offset_to_position(content, method.name_offset as usize); |
| 211 | let name_end = offset_to_position(content, method.name_offset as usize + method.name.len()); |
| 212 | let selection_range = Range::new(pos, name_end); |
| 213 | |
| 214 | // For the full range, use the name offset as the start. |
| 215 | // We don't have the method's end offset readily available, so we |
| 216 | // use the selection range as a reasonable approximation. |
| 217 | let range = selection_range; |
| 218 | |
| 219 | let detail = build_method_detail(method); |
| 220 | let tags = if method.deprecation_message.is_some() { |
| 221 | Some(vec![SymbolTag::DEPRECATED]) |
| 222 | } else { |
| 223 | None |
| 224 | }; |
| 225 | |
| 226 | let kind = if method.name == "__construct" { |
| 227 | SymbolKind::CONSTRUCTOR |
| 228 | } else { |
| 229 | SymbolKind::METHOD |
| 230 | }; |
| 231 | |
| 232 | Some(DocumentSymbol { |
| 233 | name: method.name.to_string(), |
| 234 | detail, |
| 235 | kind, |
| 236 | tags, |
| 237 | deprecated: None, |
| 238 | range, |
| 239 | selection_range, |
| 240 | children: None, |
| 241 | }) |
| 242 | } |
| 243 | |
| 244 | /// Convert a `PropertyInfo` to a `DocumentSymbol`. |
| 245 | #[allow(deprecated)] |
no test coverage detected