Sort completion calls lexicographically

This commit is contained in:
Lukas Wirth 2022-02-03 16:05:21 +01:00
parent 7619c2afea
commit d3f3b6a87f
4 changed files with 25 additions and 25 deletions

View File

@ -684,12 +684,12 @@ struct Foo { field: i32 }
impl Foo { fn foo(&self) { $0 } }"#,
expect![[r#"
fd self.field i32
me self.foo() fn(&self)
lc self &Foo
sp Self
st Foo
bt u32
fd self.field i32
me self.foo() fn(&self)
"#]],
);
check(
@ -698,12 +698,12 @@ struct Foo(i32);
impl Foo { fn foo(&mut self) { $0 } }"#,
expect![[r#"
fd self.0 i32
me self.foo() fn(&mut self)
lc self &mut Foo
sp Self
st Foo
bt u32
fd self.0 i32
me self.foo() fn(&mut self)
"#]],
);
}

View File

@ -151,27 +151,27 @@ pub fn completions(
}
let mut acc = Completions::default();
completions::attribute::complete_known_attribute_input(&mut acc, &ctx);
completions::attribute::complete_attribute(&mut acc, &ctx);
completions::use_::complete_use_tree(&mut acc, &ctx);
completions::vis::complete_vis(&mut acc, &ctx);
completions::fn_param::complete_fn_param(&mut acc, &ctx);
completions::keyword::complete_expr_keyword(&mut acc, &ctx);
completions::snippet::complete_expr_snippet(&mut acc, &ctx);
completions::snippet::complete_item_snippet(&mut acc, &ctx);
completions::qualified_path::complete_qualified_path(&mut acc, &ctx);
completions::unqualified_path::complete_unqualified_path(&mut acc, &ctx);
completions::attribute::complete_known_attribute_input(&mut acc, &ctx);
completions::dot::complete_dot(&mut acc, &ctx);
completions::record::complete_record(&mut acc, &ctx);
completions::record::complete_record_literal(&mut acc, &ctx);
completions::flyimport::import_on_the_fly(&mut acc, &ctx);
completions::fn_param::complete_fn_param(&mut acc, &ctx);
completions::format_string::format_string(&mut acc, &ctx);
completions::keyword::complete_expr_keyword(&mut acc, &ctx);
completions::lifetime::complete_label(&mut acc, &ctx);
completions::lifetime::complete_lifetime(&mut acc, &ctx);
completions::mod_::complete_mod(&mut acc, &ctx);
completions::pattern::complete_pattern(&mut acc, &ctx);
completions::postfix::complete_postfix(&mut acc, &ctx);
completions::qualified_path::complete_qualified_path(&mut acc, &ctx);
completions::record::complete_record_literal(&mut acc, &ctx);
completions::record::complete_record(&mut acc, &ctx);
completions::snippet::complete_expr_snippet(&mut acc, &ctx);
completions::snippet::complete_item_snippet(&mut acc, &ctx);
completions::trait_impl::complete_trait_impl(&mut acc, &ctx);
completions::mod_::complete_mod(&mut acc, &ctx);
completions::flyimport::import_on_the_fly(&mut acc, &ctx);
completions::lifetime::complete_lifetime(&mut acc, &ctx);
completions::lifetime::complete_label(&mut acc, &ctx);
completions::format_string::format_string(&mut acc, &ctx);
completions::unqualified_path::complete_unqualified_path(&mut acc, &ctx);
completions::use_::complete_use_tree(&mut acc, &ctx);
completions::vis::complete_vis(&mut acc, &ctx);
Some(acc)
}

View File

@ -126,6 +126,7 @@ impl Unit {
"#,
// `self` is in here twice, once as the module, once as the local
expect![[r##"
me self.foo() fn(self)
kw unsafe
kw fn
kw const
@ -172,7 +173,6 @@ impl Unit {
un Union
ev TupleV() (u32)
ct CONST
me self.foo() fn(self)
"##]],
);
check(

View File

@ -166,6 +166,10 @@ fn main() {
kw true
kw false
kw return
sn Foo {} Foo { foo1: ${1:()}, foo2: ${2:()} }$0
fd ..Default::default()
fd foo1 u32
fd foo2 u32
kw self
kw super
kw crate
@ -177,10 +181,6 @@ fn main() {
bt u32
tt Sized
tt Default
fd ..Default::default()
fd foo1 u32
fd foo2 u32
sn Foo {} Foo { foo1: ${1:()}, foo2: ${2:()} }$0
"#]],
);
check(