mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 06:11:35 +00:00
Working resolve completion imports prototype
This commit is contained in:
parent
48acd7d455
commit
6d2d279389
9 changed files with 78 additions and 46 deletions
|
@ -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.
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue