Working resolve completion imports prototype

This commit is contained in:
Kirill Bulatov 2020-11-30 22:28:19 +02:00
parent 48acd7d455
commit 6d2d279389
9 changed files with 78 additions and 46 deletions

View file

@ -257,14 +257,18 @@ impl CompletionItem {
pub fn ref_match(&self) -> Option<(Mutability, CompletionScore)> {
self.ref_match
}
pub fn import_to_add(&self) -> Option<&ImportToAdd> {
self.import_to_add.as_ref()
}
}
/// An extra import to add after the completion is applied.
#[derive(Clone)]
pub(crate) struct ImportToAdd {
pub(crate) import_path: ModPath,
pub(crate) import_scope: ImportScope,
pub(crate) merge_behaviour: Option<MergeBehaviour>,
#[derive(Debug, Clone)]
pub struct ImportToAdd {
pub import_path: ModPath,
pub import_scope: ImportScope,
pub merge_behaviour: Option<MergeBehaviour>,
}
/// A helper to make `CompletionItem`s.

View file

@ -18,7 +18,7 @@ use crate::{completions::Completions, context::CompletionContext, item::Completi
pub use crate::{
config::CompletionConfig,
item::{CompletionItem, CompletionItemKind, CompletionScore, InsertTextFormat},
item::{CompletionItem, CompletionItemKind, CompletionScore, ImportToAdd, InsertTextFormat},
};
//FIXME: split the following feature into fine-grained features.