mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 12:54:58 +00:00
Replace ID based TokenMap with proper relative text-ranges / spans
This commit is contained in:
parent
f79439caed
commit
890eb17b4e
80 changed files with 1816 additions and 2046 deletions
|
@ -60,13 +60,13 @@ pub(crate) fn goto_definition(
|
|||
.into_iter()
|
||||
.filter_map(|token| {
|
||||
let parent = token.parent()?;
|
||||
if let Some(tt) = ast::TokenTree::cast(parent) {
|
||||
if let Some(tt) = ast::TokenTree::cast(parent.clone()) {
|
||||
if let Some(x) = try_lookup_include_path(sema, tt, token.clone(), file_id) {
|
||||
return Some(vec![x]);
|
||||
}
|
||||
}
|
||||
Some(
|
||||
IdentClass::classify_token(sema, &token)?
|
||||
IdentClass::classify_node(sema, &parent)?
|
||||
.definitions()
|
||||
.into_iter()
|
||||
.flat_map(|def| {
|
||||
|
@ -392,6 +392,8 @@ fn bar() {
|
|||
);
|
||||
}
|
||||
|
||||
// FIXME: We should emit two targets here, one for the identifier in the declaration, one for
|
||||
// the macro call
|
||||
#[test]
|
||||
fn goto_def_for_macro_defined_fn_no_arg() {
|
||||
check(
|
||||
|
@ -399,10 +401,10 @@ fn bar() {
|
|||
//- /lib.rs
|
||||
macro_rules! define_fn {
|
||||
() => (fn foo() {})
|
||||
//^^^
|
||||
}
|
||||
|
||||
define_fn!();
|
||||
//^^^^^^^^^^^^^
|
||||
|
||||
fn bar() {
|
||||
$0foo();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue