mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 12:54:58 +00:00
Allow navigation targets to be duplicated when the focus range lies in the macro definition site
This commit is contained in:
parent
9b7ec5e31b
commit
9cb13b6efb
38 changed files with 851 additions and 488 deletions
|
@ -241,7 +241,7 @@ fn modpath_from_str(db: &dyn HirDatabase, link: &str) -> Option<ModPath> {
|
|||
ModPath::from_src(
|
||||
db.upcast(),
|
||||
ast_path,
|
||||
SpanMapRef::RealSpanMap(&RealSpanMap::absolute(FileId(0))),
|
||||
SpanMapRef::RealSpanMap(&RealSpanMap::absolute(FileId::BOGUS)),
|
||||
)
|
||||
};
|
||||
|
||||
|
|
|
@ -125,6 +125,7 @@ pub use {
|
|||
},
|
||||
hir_expand::{
|
||||
attrs::{Attr, AttrId},
|
||||
hygiene::{marks_rev, SyntaxContextExt},
|
||||
name::{known, Name},
|
||||
tt, ExpandResult, HirFileId, HirFileIdExt, InFile, InMacroFile, InRealFile, MacroFileId,
|
||||
},
|
||||
|
|
|
@ -9,7 +9,7 @@ use hir_def::{
|
|||
};
|
||||
use hir_expand::{HirFileId, InFile};
|
||||
use hir_ty::db::HirDatabase;
|
||||
use syntax::{ast::HasName, AstNode, SmolStr, SyntaxNode, SyntaxNodePtr};
|
||||
use syntax::{ast::HasName, AstNode, AstPtr, SmolStr, SyntaxNode, SyntaxNodePtr};
|
||||
|
||||
use crate::{Module, ModuleDef, Semantics};
|
||||
|
||||
|
@ -32,7 +32,7 @@ pub struct DeclarationLocation {
|
|||
/// This points to the whole syntax node of the declaration.
|
||||
pub ptr: SyntaxNodePtr,
|
||||
/// This points to the [`syntax::ast::Name`] identifier of the declaration.
|
||||
pub name_ptr: SyntaxNodePtr,
|
||||
pub name_ptr: AstPtr<syntax::ast::Name>,
|
||||
}
|
||||
|
||||
impl DeclarationLocation {
|
||||
|
@ -185,7 +185,7 @@ impl<'a> SymbolCollector<'a> {
|
|||
let dec_loc = DeclarationLocation {
|
||||
hir_file_id: source.file_id,
|
||||
ptr: SyntaxNodePtr::new(use_tree_src.syntax()),
|
||||
name_ptr: SyntaxNodePtr::new(name.syntax()),
|
||||
name_ptr: AstPtr::new(&name),
|
||||
};
|
||||
|
||||
self.symbols.push(FileSymbol {
|
||||
|
@ -289,7 +289,7 @@ impl<'a> SymbolCollector<'a> {
|
|||
let dec_loc = DeclarationLocation {
|
||||
hir_file_id: source.file_id,
|
||||
ptr: SyntaxNodePtr::new(source.value.syntax()),
|
||||
name_ptr: SyntaxNodePtr::new(name_node.syntax()),
|
||||
name_ptr: AstPtr::new(&name_node),
|
||||
};
|
||||
|
||||
if let Some(attrs) = def.attrs(self.db) {
|
||||
|
@ -322,7 +322,7 @@ impl<'a> SymbolCollector<'a> {
|
|||
let dec_loc = DeclarationLocation {
|
||||
hir_file_id: declaration.file_id,
|
||||
ptr: SyntaxNodePtr::new(module.syntax()),
|
||||
name_ptr: SyntaxNodePtr::new(name_node.syntax()),
|
||||
name_ptr: AstPtr::new(&name_node),
|
||||
};
|
||||
|
||||
let def = ModuleDef::Module(module_id.into());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue