aboutsummaryrefslogtreecommitdiff
path: root/crates/ide_completion/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ide_completion/src')
-rw-r--r--crates/ide_completion/src/completions/dot.rs2
-rw-r--r--crates/ide_completion/src/config.rs1
-rw-r--r--crates/ide_completion/src/render.rs2
-rw-r--r--crates/ide_completion/src/test_utils.rs1
4 files changed, 4 insertions, 2 deletions
diff --git a/crates/ide_completion/src/completions/dot.rs b/crates/ide_completion/src/completions/dot.rs
index 886251639..302c9ccbd 100644
--- a/crates/ide_completion/src/completions/dot.rs
+++ b/crates/ide_completion/src/completions/dot.rs
@@ -30,7 +30,7 @@ pub(crate) fn complete_dot(acc: &mut Completions, ctx: &CompletionContext) {
30} 30}
31 31
32fn complete_undotted_self(acc: &mut Completions, ctx: &CompletionContext) { 32fn complete_undotted_self(acc: &mut Completions, ctx: &CompletionContext) {
33 if !ctx.is_trivial_path { 33 if !ctx.is_trivial_path || !ctx.config.enable_self_on_the_fly {
34 return; 34 return;
35 } 35 }
36 ctx.scope.process_all_names(&mut |name, def| { 36 ctx.scope.process_all_names(&mut |name, def| {
diff --git a/crates/ide_completion/src/config.rs b/crates/ide_completion/src/config.rs
index d70ed6c1c..c300ce887 100644
--- a/crates/ide_completion/src/config.rs
+++ b/crates/ide_completion/src/config.rs
@@ -10,6 +10,7 @@ use ide_db::helpers::{insert_use::InsertUseConfig, SnippetCap};
10pub struct CompletionConfig { 10pub struct CompletionConfig {
11 pub enable_postfix_completions: bool, 11 pub enable_postfix_completions: bool,
12 pub enable_imports_on_the_fly: bool, 12 pub enable_imports_on_the_fly: bool,
13 pub enable_self_on_the_fly: bool,
13 pub add_call_parenthesis: bool, 14 pub add_call_parenthesis: bool,
14 pub add_call_argument_snippets: bool, 15 pub add_call_argument_snippets: bool,
15 pub snippet_cap: Option<SnippetCap>, 16 pub snippet_cap: Option<SnippetCap>,
diff --git a/crates/ide_completion/src/render.rs b/crates/ide_completion/src/render.rs
index 97dd52851..a49a60711 100644
--- a/crates/ide_completion/src/render.rs
+++ b/crates/ide_completion/src/render.rs
@@ -139,7 +139,7 @@ impl<'a> Render<'a> {
139 let mut item = CompletionItem::new( 139 let mut item = CompletionItem::new(
140 CompletionKind::Reference, 140 CompletionKind::Reference,
141 self.ctx.source_range(), 141 self.ctx.source_range(),
142 receiver.map_or_else(|| name.to_string(), |receiver| format!("{}.{}", receiver, name)), 142 receiver.map_or_else(|| name.clone(), |receiver| format!("{}.{}", receiver, name)),
143 ); 143 );
144 item.kind(SymbolKind::Field) 144 item.kind(SymbolKind::Field)
145 .detail(ty.display(self.ctx.db()).to_string()) 145 .detail(ty.display(self.ctx.db()).to_string())
diff --git a/crates/ide_completion/src/test_utils.rs b/crates/ide_completion/src/test_utils.rs
index 93c7c872c..b0a4b2026 100644
--- a/crates/ide_completion/src/test_utils.rs
+++ b/crates/ide_completion/src/test_utils.rs
@@ -19,6 +19,7 @@ use crate::{item::CompletionKind, CompletionConfig, CompletionItem};
19pub(crate) const TEST_CONFIG: CompletionConfig = CompletionConfig { 19pub(crate) const TEST_CONFIG: CompletionConfig = CompletionConfig {
20 enable_postfix_completions: true, 20 enable_postfix_completions: true,
21 enable_imports_on_the_fly: true, 21 enable_imports_on_the_fly: true,
22 enable_self_on_the_fly: true,
22 add_call_parenthesis: true, 23 add_call_parenthesis: true,
23 add_call_argument_snippets: true, 24 add_call_argument_snippets: true,
24 snippet_cap: SnippetCap::new(true), 25 snippet_cap: SnippetCap::new(true),