mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 21:05:02 +00:00
Use the new Resolver API for goto def
This commit is contained in:
parent
33ff7b56ff
commit
afce8e4426
6 changed files with 89 additions and 35 deletions
|
@ -58,6 +58,10 @@ impl ExprScopes {
|
|||
scopes
|
||||
}
|
||||
|
||||
pub fn body(&self) -> Arc<Body> {
|
||||
self.body.clone()
|
||||
}
|
||||
|
||||
pub fn entries(&self, scope: ScopeId) -> &[ScopeEntry] {
|
||||
&self.scopes[scope].entries
|
||||
}
|
||||
|
@ -220,7 +224,7 @@ impl ScopesWithSyntaxMapping {
|
|||
.collect()
|
||||
}
|
||||
|
||||
fn scope_for(&self, node: &SyntaxNode) -> Option<ScopeId> {
|
||||
pub fn scope_for(&self, node: &SyntaxNode) -> Option<ScopeId> {
|
||||
node.ancestors()
|
||||
.map(SyntaxNodePtr::new)
|
||||
.filter_map(|ptr| self.syntax_mapping.syntax_expr(ptr))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue