Skip to content

Commit eeb8b9e

Browse files
committed
Fix tests and remove unused methods
1 parent 6feb52c commit eeb8b9e

File tree

4 files changed

+7
-14
lines changed

4 files changed

+7
-14
lines changed

crates/ra_ide/src/completion/complete_keyword.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,9 @@ pub(super) fn complete_expr_keyword(acc: &mut Completions, ctx: &CompletionConte
159159
add_keyword(ctx, acc, "break", "break", ctx.in_loop_body && !ctx.can_be_stmt);
160160
add_keyword(ctx, acc, "pub", "pub ", ctx.is_new_item && !ctx.has_trait_parent);
161161

162+
if !ctx.is_trivial_path {
163+
return;
164+
}
162165
let fn_def = match &ctx.function_syntax {
163166
Some(it) => it,
164167
None => return,
@@ -182,10 +185,7 @@ fn complete_return(
182185

183186
#[cfg(test)]
184187
mod tests {
185-
use crate::completion::{
186-
test_utils::get_completions,
187-
CompletionKind,
188-
};
188+
use crate::completion::{test_utils::get_completions, CompletionKind};
189189
use insta::assert_debug_snapshot;
190190

191191
fn get_keyword_completions(code: &str) -> Vec<String> {

crates/ra_ide/src/completion/patterns.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//! Patterns telling us certain facts about current syntax element, they are used in completion context
2+
13
use ra_syntax::{
24
algo::non_trivia_sibling,
35
ast::{self, LoopBodyOwner},

crates/ra_ide/src/completion/test_utils.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,6 @@ fn get_all_completion_items(code: &str, options: &CompletionConfig) -> Vec<Compl
3838
analysis.completions(options, position).unwrap().unwrap().into()
3939
}
4040

41-
pub(crate) fn get_all_completions(code: &str, options: &CompletionConfig) -> Vec<String> {
42-
let mut kind_completions = get_all_completion_items(code, options);
43-
kind_completions.sort_by_key(|c| c.label().to_owned());
44-
kind_completions
45-
.into_iter()
46-
.map(|it| format!("{} {}", it.kind().unwrap().tag(), it.label()))
47-
.collect()
48-
}
49-
5041
pub(crate) fn get_completions_with_options(
5142
code: &str,
5243
kind: CompletionKind,

docs/user/generated_features.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ Join selected lines into one, smartly fixing up whitespace, trailing commas, and
118118

119119

120120
=== Magic Completions
121-
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ra_ide/src/completion.rs#L38[completion.rs]
121+
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ra_ide/src/completion.rs#L39[completion.rs]
122122

123123
In addition to usual reference completion, rust-analyzer provides some ✨magic✨
124124
completions as well:

0 commit comments

Comments
 (0)