mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 22:31:43 +00:00
several highlighting cleanups
* make stuff more type-safe by using `BindPat` instead of just `Pat` * don't add `mut` into binding hash * reset shadow counter when we enter a function
This commit is contained in:
parent
e418889996
commit
f9d9e0a1f7
6 changed files with 92 additions and 68 deletions
|
@ -91,24 +91,11 @@ impl NavigationTarget {
|
|||
pub(crate) fn from_pat(
|
||||
db: &RootDatabase,
|
||||
file_id: FileId,
|
||||
pat: AstPtr<ast::Pat>,
|
||||
pat: AstPtr<ast::BindPat>,
|
||||
) -> NavigationTarget {
|
||||
let parse = db.parse(file_id);
|
||||
let (name, full_range) = match pat.to_node(parse.tree().syntax()).kind() {
|
||||
ast::PatKind::BindPat(pat) => return NavigationTarget::from_bind_pat(file_id, &pat),
|
||||
_ => ("_".into(), pat.syntax_node_ptr().range()),
|
||||
};
|
||||
|
||||
NavigationTarget {
|
||||
file_id,
|
||||
name,
|
||||
full_range,
|
||||
focus_range: None,
|
||||
kind: NAME,
|
||||
container_name: None,
|
||||
description: None, //< No documentation for Description
|
||||
docs: None, //< No documentation for Pattern
|
||||
}
|
||||
let pat = pat.to_node(parse.tree().syntax());
|
||||
NavigationTarget::from_bind_pat(file_id, &pat)
|
||||
}
|
||||
|
||||
pub(crate) fn from_self_param(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue