mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-13 21:54:42 +00:00
Fix tests and remove unused methods
This commit is contained in:
parent
6feb52c12a
commit
eeb8b9e236
4 changed files with 7 additions and 14 deletions
|
@ -159,6 +159,9 @@ pub(super) fn complete_expr_keyword(acc: &mut Completions, ctx: &CompletionConte
|
|||
add_keyword(ctx, acc, "break", "break", ctx.in_loop_body && !ctx.can_be_stmt);
|
||||
add_keyword(ctx, acc, "pub", "pub ", ctx.is_new_item && !ctx.has_trait_parent);
|
||||
|
||||
if !ctx.is_trivial_path {
|
||||
return;
|
||||
}
|
||||
let fn_def = match &ctx.function_syntax {
|
||||
Some(it) => it,
|
||||
None => return,
|
||||
|
@ -182,10 +185,7 @@ fn complete_return(
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::completion::{
|
||||
test_utils::get_completions,
|
||||
CompletionKind,
|
||||
};
|
||||
use crate::completion::{test_utils::get_completions, CompletionKind};
|
||||
use insta::assert_debug_snapshot;
|
||||
|
||||
fn get_keyword_completions(code: &str) -> Vec<String> {
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
//! Patterns telling us certain facts about current syntax element, they are used in completion context
|
||||
|
||||
use ra_syntax::{
|
||||
algo::non_trivia_sibling,
|
||||
ast::{self, LoopBodyOwner},
|
||||
|
|
|
@ -38,15 +38,6 @@ fn get_all_completion_items(code: &str, options: &CompletionConfig) -> Vec<Compl
|
|||
analysis.completions(options, position).unwrap().unwrap().into()
|
||||
}
|
||||
|
||||
pub(crate) fn get_all_completions(code: &str, options: &CompletionConfig) -> Vec<String> {
|
||||
let mut kind_completions = get_all_completion_items(code, options);
|
||||
kind_completions.sort_by_key(|c| c.label().to_owned());
|
||||
kind_completions
|
||||
.into_iter()
|
||||
.map(|it| format!("{} {}", it.kind().unwrap().tag(), it.label()))
|
||||
.collect()
|
||||
}
|
||||
|
||||
pub(crate) fn get_completions_with_options(
|
||||
code: &str,
|
||||
kind: CompletionKind,
|
||||
|
|
|
@ -118,7 +118,7 @@ Join selected lines into one, smartly fixing up whitespace, trailing commas, and
|
|||
|
||||
|
||||
=== Magic Completions
|
||||
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ra_ide/src/completion.rs#L38[completion.rs]
|
||||
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ra_ide/src/completion.rs#L39[completion.rs]
|
||||
|
||||
In addition to usual reference completion, rust-analyzer provides some ✨magic✨
|
||||
completions as well:
|
||||
|
|
Loading…
Reference in a new issue