aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_api
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_ide_api')
-rw-r--r--crates/ra_ide_api/src/change.rs3
-rw-r--r--crates/ra_ide_api/src/completion/complete_postfix.rs2
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__postfix_completion_works_for_trivial_path_expression.snap9
3 files changed, 12 insertions, 2 deletions
diff --git a/crates/ra_ide_api/src/change.rs b/crates/ra_ide_api/src/change.rs
index 895b1e966..8d9918d16 100644
--- a/crates/ra_ide_api/src/change.rs
+++ b/crates/ra_ide_api/src/change.rs
@@ -163,7 +163,8 @@ impl RootDatabase {
163 if !change.new_roots.is_empty() { 163 if !change.new_roots.is_empty() {
164 let mut local_roots = Vec::clone(&self.local_roots()); 164 let mut local_roots = Vec::clone(&self.local_roots());
165 for (root_id, is_local) in change.new_roots { 165 for (root_id, is_local) in change.new_roots {
166 self.set_source_root(root_id, Default::default()); 166 let root = if is_local { SourceRoot::new() } else { SourceRoot::new_library() };
167 self.set_source_root(root_id, Arc::new(root));
167 if is_local { 168 if is_local {
168 local_roots.push(root_id); 169 local_roots.push(root_id);
169 } 170 }
diff --git a/crates/ra_ide_api/src/completion/complete_postfix.rs b/crates/ra_ide_api/src/completion/complete_postfix.rs
index 278b1b797..e20a12e2a 100644
--- a/crates/ra_ide_api/src/completion/complete_postfix.rs
+++ b/crates/ra_ide_api/src/completion/complete_postfix.rs
@@ -51,6 +51,8 @@ pub(super) fn complete_postfix(acc: &mut Completions, ctx: &CompletionContext) {
51 ) 51 )
52 .add_to(acc); 52 .add_to(acc);
53 postfix_snippet(ctx, "dbg", "dbg!(expr)", &format!("dbg!({})", receiver_text)).add_to(acc); 53 postfix_snippet(ctx, "dbg", "dbg!(expr)", &format!("dbg!({})", receiver_text)).add_to(acc);
54 postfix_snippet(ctx, "box", "Box::new(expr)", &format!("Box::new({})", receiver_text))
55 .add_to(acc);
54 } 56 }
55} 57}
56 58
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__postfix_completion_works_for_trivial_path_expression.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__postfix_completion_works_for_trivial_path_expression.snap
index fcb292596..c1a40b7b4 100644
--- a/crates/ra_ide_api/src/completion/snapshots/completion_item__postfix_completion_works_for_trivial_path_expression.snap
+++ b/crates/ra_ide_api/src/completion/snapshots/completion_item__postfix_completion_works_for_trivial_path_expression.snap
@@ -1,11 +1,18 @@
1--- 1---
2created: "2019-05-23T22:23:35.118738523Z" 2created: "2019-06-23T13:01:08.775536006Z"
3creator: [email protected] 3creator: [email protected]
4source: crates/ra_ide_api/src/completion/completion_item.rs 4source: crates/ra_ide_api/src/completion/completion_item.rs
5expression: kind_completions 5expression: kind_completions
6--- 6---
7[ 7[
8 CompletionItem { 8 CompletionItem {
9 label: "box",
10 source_range: [76; 76),
11 delete: [72; 76),
12 insert: "Box::new(bar)",
13 detail: "Box::new(expr)",
14 },
15 CompletionItem {
9 label: "dbg", 16 label: "dbg",
10 source_range: [76; 76), 17 source_range: [76; 76),
11 delete: [72; 76), 18 delete: [72; 76),