diff options
author | Kirill Bulatov <[email protected]> | 2020-11-30 20:28:19 +0000 |
---|---|---|
committer | Kirill Bulatov <[email protected]> | 2020-12-07 21:41:08 +0000 |
commit | 6d2d27938985e210d5b5e561df8a48be20343be7 (patch) | |
tree | 511e624608a4b79c8020d41425ecdaa30186891f /crates/completion | |
parent | 48acd7d455be43960d67632adc9eb176a10a8afe (diff) |
Working resolve completion imports prototype
Diffstat (limited to 'crates/completion')
-rw-r--r-- | crates/completion/src/item.rs | 14 | ||||
-rw-r--r-- | crates/completion/src/lib.rs | 2 |
2 files changed, 10 insertions, 6 deletions
diff --git a/crates/completion/src/item.rs b/crates/completion/src/item.rs index ce6a44e57..0e59f73cb 100644 --- a/crates/completion/src/item.rs +++ b/crates/completion/src/item.rs | |||
@@ -257,14 +257,18 @@ impl CompletionItem { | |||
257 | pub fn ref_match(&self) -> Option<(Mutability, CompletionScore)> { | 257 | pub fn ref_match(&self) -> Option<(Mutability, CompletionScore)> { |
258 | self.ref_match | 258 | self.ref_match |
259 | } | 259 | } |
260 | |||
261 | pub fn import_to_add(&self) -> Option<&ImportToAdd> { | ||
262 | self.import_to_add.as_ref() | ||
263 | } | ||
260 | } | 264 | } |
261 | 265 | ||
262 | /// An extra import to add after the completion is applied. | 266 | /// An extra import to add after the completion is applied. |
263 | #[derive(Clone)] | 267 | #[derive(Debug, Clone)] |
264 | pub(crate) struct ImportToAdd { | 268 | pub struct ImportToAdd { |
265 | pub(crate) import_path: ModPath, | 269 | pub import_path: ModPath, |
266 | pub(crate) import_scope: ImportScope, | 270 | pub import_scope: ImportScope, |
267 | pub(crate) merge_behaviour: Option<MergeBehaviour>, | 271 | pub merge_behaviour: Option<MergeBehaviour>, |
268 | } | 272 | } |
269 | 273 | ||
270 | /// A helper to make `CompletionItem`s. | 274 | /// A helper to make `CompletionItem`s. |
diff --git a/crates/completion/src/lib.rs b/crates/completion/src/lib.rs index 1ec2e9be7..28209d4e0 100644 --- a/crates/completion/src/lib.rs +++ b/crates/completion/src/lib.rs | |||
@@ -18,7 +18,7 @@ use crate::{completions::Completions, context::CompletionContext, item::Completi | |||
18 | 18 | ||
19 | pub use crate::{ | 19 | pub use crate::{ |
20 | config::CompletionConfig, | 20 | config::CompletionConfig, |
21 | item::{CompletionItem, CompletionItemKind, CompletionScore, InsertTextFormat}, | 21 | item::{CompletionItem, CompletionItemKind, CompletionScore, ImportToAdd, InsertTextFormat}, |
22 | }; | 22 | }; |
23 | 23 | ||
24 | //FIXME: split the following feature into fine-grained features. | 24 | //FIXME: split the following feature into fine-grained features. |