use token_ancestors_with_macros to simplify goto-def on kw

This commit is contained in:
roife 2024-07-08 04:18:32 +08:00
parent 22c5924080
commit ae6e8d56d4
2 changed files with 45 additions and 83 deletions

View file

@ -541,11 +541,7 @@ fn original_range(
file_id: HirFileId,
text_range: Option<TextRange>,
) -> Option<TextRange> {
if text_range.is_none() || !file_id.is_macro() {
return text_range;
}
InFile::new(file_id, text_range.unwrap())
InFile::new(file_id, text_range?)
.original_node_file_range_opt(db)
.map(|(frange, _)| frange.range)
}