mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-31 13:02:57 +00:00
Auto merge of #12949 - Veykril:token-pick, r=Veykril
fix: Fix incorrect token pick rankings
This commit is contained in:
commit
97038e55cf
@ -7,7 +7,7 @@ use ide_db::{
|
|||||||
search::FileReference,
|
search::FileReference,
|
||||||
FxIndexMap, RootDatabase,
|
FxIndexMap, RootDatabase,
|
||||||
};
|
};
|
||||||
use syntax::{ast, AstNode, SyntaxKind::NAME, TextRange};
|
use syntax::{ast, AstNode, SyntaxKind::IDENT, TextRange};
|
||||||
|
|
||||||
use crate::{goto_definition, FilePosition, NavigationTarget, RangeInfo, TryToNav};
|
use crate::{goto_definition, FilePosition, NavigationTarget, RangeInfo, TryToNav};
|
||||||
|
|
||||||
@ -79,7 +79,7 @@ pub(crate) fn outgoing_calls(db: &RootDatabase, position: FilePosition) -> Optio
|
|||||||
let file = sema.parse(file_id);
|
let file = sema.parse(file_id);
|
||||||
let file = file.syntax();
|
let file = file.syntax();
|
||||||
let token = pick_best_token(file.token_at_offset(position.offset), |kind| match kind {
|
let token = pick_best_token(file.token_at_offset(position.offset), |kind| match kind {
|
||||||
NAME => 1,
|
IDENT => 1,
|
||||||
_ => 0,
|
_ => 0,
|
||||||
})?;
|
})?;
|
||||||
let mut calls = CallLocations::default();
|
let mut calls = CallLocations::default();
|
||||||
|
|||||||
@ -30,7 +30,7 @@ pub(crate) fn goto_implementation(
|
|||||||
|
|
||||||
let original_token =
|
let original_token =
|
||||||
pick_best_token(syntax.token_at_offset(position.offset), |kind| match kind {
|
pick_best_token(syntax.token_at_offset(position.offset), |kind| match kind {
|
||||||
IDENT | T![self] => 1,
|
IDENT | T![self] | INT_NUMBER => 1,
|
||||||
_ => 0,
|
_ => 0,
|
||||||
})?;
|
})?;
|
||||||
let range = original_token.text_range();
|
let range = original_token.text_range();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user