diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-11-17 17:50:08 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2020-11-17 17:50:08 +0000 |
commit | 156f7d6963fb6b47570bfa457fdf51733a182054 (patch) | |
tree | 1070543fd0be92d3ab720bc297962a5dad5e64e8 /crates/completion/src/config.rs | |
parent | f4b4f17662a7a1c80743b3108bb0da28b0fe47e5 (diff) | |
parent | 16f0b2fdde2fba8f45cc18a8de11b45751c0f923 (diff) |
Merge #6553
6553: Auto imports in completion r=matklad a=SomeoneToIgnore
![completion](https://user-images.githubusercontent.com/2690773/99155339-ae4fb380-26bf-11eb-805a-655b1706ce70.gif)
Closes https://github.com/rust-analyzer/rust-analyzer/issues/1062 but does not handle the completion order, since it's a separate task for https://github.com/rust-analyzer/rust-analyzer/issues/4922 , https://github.com/rust-analyzer/rust-analyzer/issues/4922 and maybe something else.
2 quirks in the current implementation:
* traits are not auto imported during method completion
If I understand the current situation right, we cannot search for traits by a **part** of a method name, we need a full name with correct case to get a trait for it.
* VSCode (?) autocompletion is not as rigid as in Intellij Rust as you can notice on the animation.
Intellij is able to refresh the completions on every new symbol added, yet VS Code does not query the completions on every symbol for me.
With a few debug prints placed in RA, I've observed the following behaviour: after the first set of completion suggestions is received, next symbol input does not trigger a server request, if the completions contain this symbol.
When more symbols added, the existing completion suggestions are filtered out until none are left and only then, on the next symbol it queries for completions.
It seems like the only alternative to get an updated set of results is to manually retrigger it with Esc and Ctrl + Space.
Despite the eerie latter bullet, the completion seems to work pretty fine and fast nontheless, but if you have any ideas on how to make it more smooth, I'll gladly try it out.
Co-authored-by: Kirill Bulatov <[email protected]>
Diffstat (limited to 'crates/completion/src/config.rs')
-rw-r--r-- | crates/completion/src/config.rs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/crates/completion/src/config.rs b/crates/completion/src/config.rs index 71b49ace8..82874ff25 100644 --- a/crates/completion/src/config.rs +++ b/crates/completion/src/config.rs | |||
@@ -4,12 +4,15 @@ | |||
4 | //! module, and we use to statically check that we only produce snippet | 4 | //! module, and we use to statically check that we only produce snippet |
5 | //! completions if we are allowed to. | 5 | //! completions if we are allowed to. |
6 | 6 | ||
7 | use assists::utils::MergeBehaviour; | ||
8 | |||
7 | #[derive(Clone, Debug, PartialEq, Eq)] | 9 | #[derive(Clone, Debug, PartialEq, Eq)] |
8 | pub struct CompletionConfig { | 10 | pub struct CompletionConfig { |
9 | pub enable_postfix_completions: bool, | 11 | pub enable_postfix_completions: bool, |
10 | pub add_call_parenthesis: bool, | 12 | pub add_call_parenthesis: bool, |
11 | pub add_call_argument_snippets: bool, | 13 | pub add_call_argument_snippets: bool, |
12 | pub snippet_cap: Option<SnippetCap>, | 14 | pub snippet_cap: Option<SnippetCap>, |
15 | pub merge: Option<MergeBehaviour>, | ||
13 | } | 16 | } |
14 | 17 | ||
15 | impl CompletionConfig { | 18 | impl CompletionConfig { |
@@ -30,6 +33,7 @@ impl Default for CompletionConfig { | |||
30 | add_call_parenthesis: true, | 33 | add_call_parenthesis: true, |
31 | add_call_argument_snippets: true, | 34 | add_call_argument_snippets: true, |
32 | snippet_cap: Some(SnippetCap { _private: () }), | 35 | snippet_cap: Some(SnippetCap { _private: () }), |
36 | merge: Some(MergeBehaviour::Full), | ||
33 | } | 37 | } |
34 | } | 38 | } |
35 | } | 39 | } |