mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-28 18:43:01 +00:00
fix: Improve diagnostic ranges for macro_calls!
We used to point to the entire macro call including its token tree if we couldn't upmap the diagnostic to the input This generally makes things very noisy as the entire macro call will turn red on errors. Instead, we now macro the path and `!` (bang) token as the error source range which is a lot nicer on the eyes.
This commit is contained in:
parent
661e7d2ac2
commit
2480a42ff4
12 changed files with 71 additions and 49 deletions
|
|
@ -317,7 +317,7 @@ impl Definition {
|
|||
};
|
||||
return match def {
|
||||
Some(def) => SearchScope::file_range(
|
||||
def.as_ref().original_file_range_with_macro_call_body(db),
|
||||
def.as_ref().original_file_range_with_macro_call_input(db),
|
||||
),
|
||||
None => SearchScope::single_file(file_id),
|
||||
};
|
||||
|
|
@ -332,7 +332,7 @@ impl Definition {
|
|||
};
|
||||
return match def {
|
||||
Some(def) => SearchScope::file_range(
|
||||
def.as_ref().original_file_range_with_macro_call_body(db),
|
||||
def.as_ref().original_file_range_with_macro_call_input(db),
|
||||
),
|
||||
None => SearchScope::single_file(file_id),
|
||||
};
|
||||
|
|
@ -341,7 +341,7 @@ impl Definition {
|
|||
if let Definition::SelfType(impl_) = self {
|
||||
return match impl_.source(db).map(|src| src.syntax().cloned()) {
|
||||
Some(def) => SearchScope::file_range(
|
||||
def.as_ref().original_file_range_with_macro_call_body(db),
|
||||
def.as_ref().original_file_range_with_macro_call_input(db),
|
||||
),
|
||||
None => SearchScope::single_file(file_id),
|
||||
};
|
||||
|
|
@ -360,7 +360,7 @@ impl Definition {
|
|||
};
|
||||
return match def {
|
||||
Some(def) => SearchScope::file_range(
|
||||
def.as_ref().original_file_range_with_macro_call_body(db),
|
||||
def.as_ref().original_file_range_with_macro_call_input(db),
|
||||
),
|
||||
None => SearchScope::single_file(file_id),
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue