mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-11-15 01:17:27 +00:00
Merge #4099
4099: Remove SyntaxPtr::range from more places r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
This commit is contained in:
commit
4a18509a98
3 changed files with 8 additions and 3 deletions
|
@ -325,8 +325,11 @@ mod tests {
|
|||
let resolved = scopes.resolve_name_in_scope(expr_scope, &name_ref.as_name()).unwrap();
|
||||
let pat_src = source_map.pat_syntax(resolved.pat()).unwrap();
|
||||
|
||||
let local_name = pat_src.value.either(|it| it.syntax_node_ptr(), |it| it.syntax_node_ptr());
|
||||
assert_eq!(local_name.range(), expected_name.syntax().text_range());
|
||||
let local_name = pat_src.value.either(
|
||||
|it| it.syntax_node_ptr().to_node(file.syntax()),
|
||||
|it| it.syntax_node_ptr().to_node(file.syntax()),
|
||||
);
|
||||
assert_eq!(local_name.text_range(), expected_name.syntax().text_range());
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
|
@ -176,7 +176,7 @@ impl ToNav for FileSymbol {
|
|||
file_id: self.file_id,
|
||||
name: self.name.clone(),
|
||||
kind: self.kind,
|
||||
full_range: self.ptr.range(),
|
||||
full_range: self.range,
|
||||
focus_range: self.name_range,
|
||||
container_name: self.container_name.clone(),
|
||||
description: description_from_symbol(db, self),
|
||||
|
|
|
@ -313,6 +313,7 @@ pub struct FileSymbol {
|
|||
pub file_id: FileId,
|
||||
pub name: SmolStr,
|
||||
pub kind: SyntaxKind,
|
||||
pub range: TextRange,
|
||||
pub ptr: SyntaxNodePtr,
|
||||
pub name_range: Option<TextRange>,
|
||||
pub container_name: Option<SmolStr>,
|
||||
|
@ -379,6 +380,7 @@ fn to_file_symbol(node: &SyntaxNode, file_id: FileId) -> Option<FileSymbol> {
|
|||
to_symbol(node).map(move |(name, ptr, name_range)| FileSymbol {
|
||||
name,
|
||||
kind: node.kind(),
|
||||
range: node.text_range(),
|
||||
ptr,
|
||||
file_id,
|
||||
name_range: Some(name_range),
|
||||
|
|
Loading…
Reference in a new issue