aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_ide/src')
-rw-r--r--crates/ra_ide/src/completion/complete_path.rs13
-rw-r--r--crates/ra_ide/src/marks.rs1
2 files changed, 7 insertions, 7 deletions
diff --git a/crates/ra_ide/src/completion/complete_path.rs b/crates/ra_ide/src/completion/complete_path.rs
index af24e9f48..2d7f09a6c 100644
--- a/crates/ra_ide/src/completion/complete_path.rs
+++ b/crates/ra_ide/src/completion/complete_path.rs
@@ -1,4 +1,4 @@
1//! FIXME: write short doc here 1//! Completion of paths, including when writing a single name.
2 2
3use hir::{Adt, PathResolution, ScopeDef}; 3use hir::{Adt, PathResolution, ScopeDef};
4use ra_syntax::AstNode; 4use ra_syntax::AstNode;
@@ -20,10 +20,6 @@ pub(super) fn complete_path(acc: &mut Completions, ctx: &CompletionContext) {
20 let module_scope = module.scope(ctx.db); 20 let module_scope = module.scope(ctx.db);
21 for (name, def) in module_scope { 21 for (name, def) in module_scope {
22 if ctx.use_item_syntax.is_some() { 22 if ctx.use_item_syntax.is_some() {
23 if let hir::ScopeDef::ModuleDef(hir::ModuleDef::BuiltinType(..)) = def {
24 tested_by!(dont_complete_primitive_in_use);
25 continue;
26 }
27 if let ScopeDef::Unknown = def { 23 if let ScopeDef::Unknown = def {
28 if let Some(name_ref) = ctx.name_ref_syntax.as_ref() { 24 if let Some(name_ref) = ctx.name_ref_syntax.as_ref() {
29 if name_ref.syntax().text() == name.to_string().as_str() { 25 if name_ref.syntax().text() == name.to_string().as_str() {
@@ -125,12 +121,17 @@ mod tests {
125 121
126 #[test] 122 #[test]
127 fn dont_complete_primitive_in_use() { 123 fn dont_complete_primitive_in_use() {
128 covers!(dont_complete_primitive_in_use);
129 let completions = do_completion(r"use self::<|>;", CompletionKind::BuiltinType); 124 let completions = do_completion(r"use self::<|>;", CompletionKind::BuiltinType);
130 assert!(completions.is_empty()); 125 assert!(completions.is_empty());
131 } 126 }
132 127
133 #[test] 128 #[test]
129 fn dont_complete_primitive_in_module_scope() {
130 let completions = do_completion(r"fn foo() { self::<|> }", CompletionKind::BuiltinType);
131 assert!(completions.is_empty());
132 }
133
134 #[test]
134 fn completes_primitives() { 135 fn completes_primitives() {
135 let completions = 136 let completions =
136 do_completion(r"fn main() { let _: <|> = 92; }", CompletionKind::BuiltinType); 137 do_completion(r"fn main() { let _: <|> = 92; }", CompletionKind::BuiltinType);
diff --git a/crates/ra_ide/src/marks.rs b/crates/ra_ide/src/marks.rs
index 5bf4d2062..bcb67e373 100644
--- a/crates/ra_ide/src/marks.rs
+++ b/crates/ra_ide/src/marks.rs
@@ -10,6 +10,5 @@ test_utils::marks!(
10 goto_def_for_field_init_shorthand 10 goto_def_for_field_init_shorthand
11 call_info_bad_offset 11 call_info_bad_offset
12 dont_complete_current_use 12 dont_complete_current_use
13 dont_complete_primitive_in_use
14 test_resolve_parent_module_on_module_decl 13 test_resolve_parent_module_on_module_decl
15); 14);