mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 12:54:58 +00:00
Tidy up
This commit is contained in:
parent
8c292e3cc5
commit
0415dcd832
2 changed files with 26 additions and 32 deletions
|
@ -265,11 +265,11 @@ impl Test for T {
|
||||||
t<|>
|
t<|>
|
||||||
}
|
}
|
||||||
"#,
|
"#,
|
||||||
expect![[r#"
|
expect![["
|
||||||
ta type TestType =
|
ta type TestType = \n\
|
||||||
ct const TEST_CONST: u16 =
|
ct const TEST_CONST: u16 = \n\
|
||||||
fn fn test()
|
fn fn test()
|
||||||
"#]],
|
"]],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -153,15 +153,15 @@ fn fuzzy_completion(acc: &mut Completions, ctx: &CompletionContext) -> Option<()
|
||||||
acc.add_all(all_mod_paths.into_iter().filter_map(|(import_path, definition)| {
|
acc.add_all(all_mod_paths.into_iter().filter_map(|(import_path, definition)| {
|
||||||
render_resolution_with_import(
|
render_resolution_with_import(
|
||||||
RenderContext::new(ctx),
|
RenderContext::new(ctx),
|
||||||
ImportEdit { import_path: import_path, import_scope: import_scope.clone() },
|
ImportEdit { import_path, import_scope: import_scope.clone() },
|
||||||
&definition,
|
&definition,
|
||||||
)
|
)
|
||||||
}));
|
}));
|
||||||
Some(())
|
Some(())
|
||||||
}
|
}
|
||||||
|
|
||||||
// todo kb add tet marks for the completion order test + the sotring description
|
|
||||||
fn compute_fuzzy_completion_order_key(proposed_mod_path: &ModPath, user_input: &str) -> usize {
|
fn compute_fuzzy_completion_order_key(proposed_mod_path: &ModPath, user_input: &str) -> usize {
|
||||||
|
mark::hit!(certain_fuzzy_order_test);
|
||||||
let proposed_import_name = match proposed_mod_path.segments.last() {
|
let proposed_import_name = match proposed_mod_path.segments.last() {
|
||||||
Some(name) => name.to_string().to_lowercase(),
|
Some(name) => name.to_string().to_lowercase(),
|
||||||
None => return usize::MAX,
|
None => return usize::MAX,
|
||||||
|
@ -193,6 +193,14 @@ mod tests {
|
||||||
expect.assert_eq(&actual)
|
expect.assert_eq(&actual)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn fuzzy_completion_config() -> CompletionConfig {
|
||||||
|
let mut completion_config = CompletionConfig::default();
|
||||||
|
completion_config
|
||||||
|
.active_resolve_capabilities
|
||||||
|
.insert(crate::CompletionResolveCapability::AdditionalTextEdits);
|
||||||
|
completion_config
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn self_fulfilling_completion() {
|
fn self_fulfilling_completion() {
|
||||||
mark::check!(self_fulfilling_completion);
|
mark::check!(self_fulfilling_completion);
|
||||||
|
@ -794,13 +802,8 @@ impl My<|>
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn function_fuzzy_completion() {
|
fn function_fuzzy_completion() {
|
||||||
let mut completion_config = CompletionConfig::default();
|
|
||||||
completion_config
|
|
||||||
.active_resolve_capabilities
|
|
||||||
.insert(crate::CompletionResolveCapability::AdditionalTextEdits);
|
|
||||||
|
|
||||||
check_edit_with_config(
|
check_edit_with_config(
|
||||||
completion_config,
|
fuzzy_completion_config(),
|
||||||
"stdin",
|
"stdin",
|
||||||
r#"
|
r#"
|
||||||
//- /lib.rs crate:dep
|
//- /lib.rs crate:dep
|
||||||
|
@ -825,13 +828,8 @@ fn main() {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn macro_fuzzy_completion() {
|
fn macro_fuzzy_completion() {
|
||||||
let mut completion_config = CompletionConfig::default();
|
|
||||||
completion_config
|
|
||||||
.active_resolve_capabilities
|
|
||||||
.insert(crate::CompletionResolveCapability::AdditionalTextEdits);
|
|
||||||
|
|
||||||
check_edit_with_config(
|
check_edit_with_config(
|
||||||
completion_config,
|
fuzzy_completion_config(),
|
||||||
"macro_with_curlies!",
|
"macro_with_curlies!",
|
||||||
r#"
|
r#"
|
||||||
//- /lib.rs crate:dep
|
//- /lib.rs crate:dep
|
||||||
|
@ -858,13 +856,8 @@ fn main() {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn struct_fuzzy_completion() {
|
fn struct_fuzzy_completion() {
|
||||||
let mut completion_config = CompletionConfig::default();
|
|
||||||
completion_config
|
|
||||||
.active_resolve_capabilities
|
|
||||||
.insert(crate::CompletionResolveCapability::AdditionalTextEdits);
|
|
||||||
|
|
||||||
check_edit_with_config(
|
check_edit_with_config(
|
||||||
completion_config,
|
fuzzy_completion_config(),
|
||||||
"ThirdStruct",
|
"ThirdStruct",
|
||||||
r#"
|
r#"
|
||||||
//- /lib.rs crate:dep
|
//- /lib.rs crate:dep
|
||||||
|
@ -893,21 +886,22 @@ fn main() {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn fuzzy_completions_come_in_specific_order() {
|
fn fuzzy_completions_come_in_specific_order() {
|
||||||
let mut completion_config = CompletionConfig::default();
|
mark::check!(certain_fuzzy_order_test);
|
||||||
completion_config
|
|
||||||
.active_resolve_capabilities
|
|
||||||
.insert(crate::CompletionResolveCapability::AdditionalTextEdits);
|
|
||||||
|
|
||||||
check_with_config(
|
check_with_config(
|
||||||
completion_config,
|
fuzzy_completion_config(),
|
||||||
r#"
|
r#"
|
||||||
//- /lib.rs crate:dep
|
//- /lib.rs crate:dep
|
||||||
pub struct FirstStruct;
|
pub struct FirstStruct;
|
||||||
pub mod some_module {
|
pub mod some_module {
|
||||||
|
// already imported, omitted
|
||||||
pub struct SecondStruct;
|
pub struct SecondStruct;
|
||||||
|
// does not contain all letters from the query, omitted
|
||||||
|
pub struct UnrelatedOne;
|
||||||
|
// contains all letters from the query, but not in sequence, displayed last
|
||||||
pub struct ThiiiiiirdStruct;
|
pub struct ThiiiiiirdStruct;
|
||||||
|
// contains all letters from the query, but not in the beginning, displayed second
|
||||||
pub struct AfterThirdStruct;
|
pub struct AfterThirdStruct;
|
||||||
|
// contains all letters from the query in the begginning, displayed first
|
||||||
pub struct ThirdStruct;
|
pub struct ThirdStruct;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue