diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2018-12-27 10:08:34 +0000 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2018-12-27 10:08:34 +0000 |
commit | 1d6dcef5c584d0dffdf5386eec993e41daad0210 (patch) | |
tree | 1e67675b7031115b1811863d0f186ad1f98b1fce /crates/ra_analysis/src/completion.rs | |
parent | 700165cf17290561dea511565278b9869ed61625 (diff) | |
parent | bc745a139674f289386f3081458793f756cab5b9 (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.rs | 8 |
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 @@ | |||
1 | mod completion_item; | 1 | mod completion_item; |
2 | mod completion_context; | 2 | mod completion_context; |
3 | 3 | ||
4 | mod complete_dot; | ||
4 | mod complete_fn_param; | 5 | mod complete_fn_param; |
5 | mod complete_keyword; | 6 | mod complete_keyword; |
6 | mod complete_snippet; | 7 | mod complete_snippet; |
@@ -20,13 +21,13 @@ use crate::{ | |||
20 | 21 | ||
21 | pub use crate::completion::completion_item::{CompletionItem, InsertText, CompletionItemKind}; | 22 | pub 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. |
31 | pub(crate) fn completions( | 32 | pub(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 | } |