aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_analysis/src/completion.rs
diff options
context:
space:
mode:
authorbors[bot] <bors[bot]@users.noreply.github.com>2018-12-27 10:08:34 +0000
committerbors[bot] <bors[bot]@users.noreply.github.com>2018-12-27 10:08:34 +0000
commit1d6dcef5c584d0dffdf5386eec993e41daad0210 (patch)
tree1e67675b7031115b1811863d0f186ad1f98b1fce /crates/ra_analysis/src/completion.rs
parent700165cf17290561dea511565278b9869ed61625 (diff)
parentbc745a139674f289386f3081458793f756cab5b9 (diff)
Merge #332
332: Struct types r=matklad a=flodiebold Infer types for struct fields, and add basic field completions. There's also some code for enums, but I focused on getting structs working. There's still ways to go before this becomes useful: There's no autoderef (or even reference types) and no inference for `self`, for example. Co-authored-by: Florian Diebold <[email protected]>
Diffstat (limited to 'crates/ra_analysis/src/completion.rs')
-rw-r--r--crates/ra_analysis/src/completion.rs8
1 files changed, 5 insertions, 3 deletions
diff --git a/crates/ra_analysis/src/completion.rs b/crates/ra_analysis/src/completion.rs
index d742d6295..fe580700f 100644
--- a/crates/ra_analysis/src/completion.rs
+++ b/crates/ra_analysis/src/completion.rs
@@ -1,6 +1,7 @@
1mod completion_item; 1mod completion_item;
2mod completion_context; 2mod completion_context;
3 3
4mod complete_dot;
4mod complete_fn_param; 5mod complete_fn_param;
5mod complete_keyword; 6mod complete_keyword;
6mod complete_snippet; 7mod complete_snippet;
@@ -20,13 +21,13 @@ use crate::{
20 21
21pub use crate::completion::completion_item::{CompletionItem, InsertText, CompletionItemKind}; 22pub use crate::completion::completion_item::{CompletionItem, InsertText, CompletionItemKind};
22 23
23/// Main entry point for copmletion. We run comletion as a two-phase process. 24/// Main entry point for completion. We run completion as a two-phase process.
24/// 25///
25/// First, we look at the position and collect a so-called `CompletionContext. 26/// First, we look at the position and collect a so-called `CompletionContext.
26/// This is a somewhat messy process, because, during completion, syntax tree is 27/// This is a somewhat messy process, because, during completion, syntax tree is
27/// incomplete and can look readlly weired. 28/// incomplete and can look really weird.
28/// 29///
29/// Once the context is collected, we run a series of completion routines whihc 30/// Once the context is collected, we run a series of completion routines which
30/// look at the context and produce completion items. 31/// look at the context and produce completion items.
31pub(crate) fn completions( 32pub(crate) fn completions(
32 db: &db::RootDatabase, 33 db: &db::RootDatabase,
@@ -43,6 +44,7 @@ pub(crate) fn completions(
43 complete_snippet::complete_item_snippet(&mut acc, &ctx); 44 complete_snippet::complete_item_snippet(&mut acc, &ctx);
44 complete_path::complete_path(&mut acc, &ctx)?; 45 complete_path::complete_path(&mut acc, &ctx)?;
45 complete_scope::complete_scope(&mut acc, &ctx)?; 46 complete_scope::complete_scope(&mut acc, &ctx)?;
47 complete_dot::complete_dot(&mut acc, &ctx)?;
46 48
47 Ok(Some(acc)) 49 Ok(Some(acc))
48} 50}