mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-26 13:03:31 +00:00
flip params
This commit is contained in:
parent
74406ca8ea
commit
b0ff6176ed
1 changed files with 3 additions and 3 deletions
|
@ -41,7 +41,7 @@ pub(crate) fn completions(
|
||||||
reference_completion::completions(&mut res, db, &module, &file, name_ref)?;
|
reference_completion::completions(&mut res, db, &module, &file, name_ref)?;
|
||||||
// special case, `trait T { fn foo(i_am_a_name_ref) {} }`
|
// special case, `trait T { fn foo(i_am_a_name_ref) {} }`
|
||||||
if is_node::<ast::Param>(name_ref.syntax()) {
|
if is_node::<ast::Param>(name_ref.syntax()) {
|
||||||
param_completions(name_ref.syntax(), &mut res);
|
param_completions(&mut res, name_ref.syntax());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ pub(crate) fn completions(
|
||||||
if let Some(name) = find_node_at_offset::<ast::Name>(file.syntax(), position.offset) {
|
if let Some(name) = find_node_at_offset::<ast::Name>(file.syntax(), position.offset) {
|
||||||
if is_node::<ast::Param>(name.syntax()) {
|
if is_node::<ast::Param>(name.syntax()) {
|
||||||
has_completions = true;
|
has_completions = true;
|
||||||
param_completions(name.syntax(), &mut res);
|
param_completions(&mut res, name.syntax());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let res = if has_completions { Some(res) } else { None };
|
let res = if has_completions { Some(res) } else { None };
|
||||||
|
@ -60,7 +60,7 @@ pub(crate) fn completions(
|
||||||
/// functions in a file have a `spam: &mut Spam` parameter, a completion with
|
/// functions in a file have a `spam: &mut Spam` parameter, a completion with
|
||||||
/// `spam: &mut Spam` insert text/label and `spam` lookup string will be
|
/// `spam: &mut Spam` insert text/label and `spam` lookup string will be
|
||||||
/// suggested.
|
/// suggested.
|
||||||
fn param_completions(ctx: SyntaxNodeRef, acc: &mut Vec<CompletionItem>) {
|
fn param_completions(acc: &mut Vec<CompletionItem>, ctx: SyntaxNodeRef) {
|
||||||
let mut params = FxHashMap::default();
|
let mut params = FxHashMap::default();
|
||||||
for node in ctx.ancestors() {
|
for node in ctx.ancestors() {
|
||||||
let _ = visitor_ctx(&mut params)
|
let _ = visitor_ctx(&mut params)
|
||||||
|
|
Loading…
Reference in a new issue