From 821e8369d994ebca39ccbf9b449c604d0c910efc Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Mon, 1 Mar 2021 14:14:24 +0200 Subject: Update the docs --- crates/ide_completion/src/completions/flyimport.rs | 39 ++++++++++++++++++++++ 1 file changed, 39 insertions(+) (limited to 'crates/ide_completion/src/completions/flyimport.rs') diff --git a/crates/ide_completion/src/completions/flyimport.rs b/crates/ide_completion/src/completions/flyimport.rs index c6b83da3d..1ef6f8afb 100644 --- a/crates/ide_completion/src/completions/flyimport.rs +++ b/crates/ide_completion/src/completions/flyimport.rs @@ -21,6 +21,45 @@ //! ``` //! //! Also completes associated items, that require trait imports. +//! If any unresolved and/or partially-qualified path predeces the input, it will be taken into account: only the items with import string +//! containing this whole path will be considered and the corresponding path import will be added: +//! +//! ``` +//! mod foo { +//! pub mod bar { +//! pub struct Item; +//! +//! impl Item { +//! pub const TEST_ASSOC: usize = 3; +//! } +//! } +//! } +//! +//! fn main() { +//! bar::Item::TEST_A$0 +//! } +//! ``` +//! -> +//! ``` +//! use foo::bar; +//! +//! mod foo { +//! pub mod bar { +//! pub struct Item; +//! +//! impl Item { +//! pub const TEST_ASSOC: usize = 3; +//! } +//! } +//! } +//! +//! fn main() { +//! bar::Item::TEST_ASSOC +//! } +//! ``` +//! +//! NOTE: currently, if an assoc item comes from a trait that's not currently imported and it also has an unresolved and/or partially-qualified path, +//! no imports will be proposed. //! //! .Fuzzy search details //! -- cgit v1.2.3