aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_api/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_ide_api/src')
-rw-r--r--crates/ra_ide_api/src/call_info.rs2
-rw-r--r--crates/ra_ide_api/src/change.rs12
-rw-r--r--crates/ra_ide_api/src/completion/complete_dot.rs4
-rw-r--r--crates/ra_ide_api/src/completion/complete_path.rs4
-rw-r--r--crates/ra_ide_api/src/completion/presentation.rs12
5 files changed, 19 insertions, 15 deletions
diff --git a/crates/ra_ide_api/src/call_info.rs b/crates/ra_ide_api/src/call_info.rs
index bd08e183d..2948c646b 100644
--- a/crates/ra_ide_api/src/call_info.rs
+++ b/crates/ra_ide_api/src/call_info.rs
@@ -35,7 +35,7 @@ pub(crate) fn call_info(db: &RootDatabase, position: FilePosition) -> Option<Cal
35 35
36 // If we have a calling expression let's find which argument we are on 36 // If we have a calling expression let's find which argument we are on
37 let num_params = call_info.parameters().len(); 37 let num_params = call_info.parameters().len();
38 let has_self = function.signature(db).has_self_param(); 38 let has_self = function.data(db).has_self_param();
39 39
40 if num_params == 1 { 40 if num_params == 1 {
41 if !has_self { 41 if !has_self {
diff --git a/crates/ra_ide_api/src/change.rs b/crates/ra_ide_api/src/change.rs
index ce03a0f95..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 }
@@ -226,9 +227,12 @@ impl RootDatabase {
226 227
227 self.query(ra_db::ParseQuery).sweep(sweep); 228 self.query(ra_db::ParseQuery).sweep(sweep);
228 self.query(hir::db::ParseMacroQuery).sweep(sweep); 229 self.query(hir::db::ParseMacroQuery).sweep(sweep);
229 self.query(hir::db::MacroDefQuery).sweep(sweep); 230
230 self.query(hir::db::MacroArgQuery).sweep(sweep); 231 // Macros do take significant space, but less then the syntax trees
231 self.query(hir::db::MacroExpandQuery).sweep(sweep); 232 // self.query(hir::db::MacroDefQuery).sweep(sweep);
233 // self.query(hir::db::MacroArgQuery).sweep(sweep);
234 // self.query(hir::db::MacroExpandQuery).sweep(sweep);
235
232 self.query(hir::db::AstIdMapQuery).sweep(sweep); 236 self.query(hir::db::AstIdMapQuery).sweep(sweep);
233 237
234 self.query(hir::db::RawItemsWithSourceMapQuery).sweep(sweep); 238 self.query(hir::db::RawItemsWithSourceMapQuery).sweep(sweep);
diff --git a/crates/ra_ide_api/src/completion/complete_dot.rs b/crates/ra_ide_api/src/completion/complete_dot.rs
index f26fd06b3..40bd1e75e 100644
--- a/crates/ra_ide_api/src/completion/complete_dot.rs
+++ b/crates/ra_ide_api/src/completion/complete_dot.rs
@@ -37,8 +37,8 @@ fn complete_fields(acc: &mut Completions, ctx: &CompletionContext, receiver: Ty)
37 37
38fn complete_methods(acc: &mut Completions, ctx: &CompletionContext, receiver: Ty) { 38fn complete_methods(acc: &mut Completions, ctx: &CompletionContext, receiver: Ty) {
39 ctx.analyzer.iterate_method_candidates(ctx.db, receiver, None, |_ty, func| { 39 ctx.analyzer.iterate_method_candidates(ctx.db, receiver, None, |_ty, func| {
40 let sig = func.signature(ctx.db); 40 let data = func.data(ctx.db);
41 if sig.has_self_param() { 41 if data.has_self_param() {
42 acc.add_function(ctx, func); 42 acc.add_function(ctx, func);
43 } 43 }
44 None::<()> 44 None::<()>
diff --git a/crates/ra_ide_api/src/completion/complete_path.rs b/crates/ra_ide_api/src/completion/complete_path.rs
index 99da24142..c14af593b 100644
--- a/crates/ra_ide_api/src/completion/complete_path.rs
+++ b/crates/ra_ide_api/src/completion/complete_path.rs
@@ -49,8 +49,8 @@ pub(super) fn complete_path(acc: &mut Completions, ctx: &CompletionContext) {
49 ty.iterate_impl_items(ctx.db, krate, |item| { 49 ty.iterate_impl_items(ctx.db, krate, |item| {
50 match item { 50 match item {
51 hir::ImplItem::Method(func) => { 51 hir::ImplItem::Method(func) => {
52 let sig = func.signature(ctx.db); 52 let data = func.data(ctx.db);
53 if !sig.has_self_param() { 53 if !data.has_self_param() {
54 acc.add_function(ctx, func); 54 acc.add_function(ctx, func);
55 } 55 }
56 } 56 }
diff --git a/crates/ra_ide_api/src/completion/presentation.rs b/crates/ra_ide_api/src/completion/presentation.rs
index f4ff4404b..973936736 100644
--- a/crates/ra_ide_api/src/completion/presentation.rs
+++ b/crates/ra_ide_api/src/completion/presentation.rs
@@ -98,13 +98,13 @@ impl Completions {
98 name: Option<String>, 98 name: Option<String>,
99 func: hir::Function, 99 func: hir::Function,
100 ) { 100 ) {
101 let sig = func.signature(ctx.db); 101 let data = func.data(ctx.db);
102 let name = name.unwrap_or_else(|| sig.name().to_string()); 102 let name = name.unwrap_or_else(|| data.name().to_string());
103 let ast_node = func.source(ctx.db).ast; 103 let ast_node = func.source(ctx.db).ast;
104 let detail = function_label(&ast_node); 104 let detail = function_label(&ast_node);
105 105
106 let mut builder = CompletionItem::new(CompletionKind::Reference, ctx.source_range(), name) 106 let mut builder = CompletionItem::new(CompletionKind::Reference, ctx.source_range(), name)
107 .kind(if sig.has_self_param() { 107 .kind(if data.has_self_param() {
108 CompletionItemKind::Method 108 CompletionItemKind::Method
109 } else { 109 } else {
110 CompletionItemKind::Function 110 CompletionItemKind::Function
@@ -115,10 +115,10 @@ impl Completions {
115 if ctx.use_item_syntax.is_none() && !ctx.is_call { 115 if ctx.use_item_syntax.is_none() && !ctx.is_call {
116 tested_by!(inserts_parens_for_function_calls); 116 tested_by!(inserts_parens_for_function_calls);
117 let snippet = 117 let snippet =
118 if sig.params().is_empty() || sig.has_self_param() && sig.params().len() == 1 { 118 if data.params().is_empty() || data.has_self_param() && data.params().len() == 1 {
119 format!("{}()$0", sig.name()) 119 format!("{}()$0", data.name())
120 } else { 120 } else {
121 format!("{}($0)", sig.name()) 121 format!("{}($0)", data.name())
122 }; 122 };
123 builder = builder.insert_snippet(snippet); 123 builder = builder.insert_snippet(snippet);
124 } 124 }