From b6fcacd96d26e7edaf37bda852b8b3ad104d4c90 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sun, 27 Oct 2019 17:49:39 +0300 Subject: move all assists to use generated docs --- crates/ra_assists/src/assists/add_import.rs | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'crates/ra_assists/src/assists') diff --git a/crates/ra_assists/src/assists/add_import.rs b/crates/ra_assists/src/assists/add_import.rs index c522d6a5a..e87fae1af 100644 --- a/crates/ra_assists/src/assists/add_import.rs +++ b/crates/ra_assists/src/assists/add_import.rs @@ -1,5 +1,3 @@ -//! FIXME: write short doc here - use hir::{self, db::HirDatabase}; use ra_syntax::{ ast::{self, NameOwner}, @@ -14,9 +12,9 @@ use crate::{ AssistId, }; -// This function produces sequence of text edits into edit -// to import the target path in the most appropriate scope given -// the cursor position +/// This function produces sequence of text edits into edit +/// to import the target path in the most appropriate scope given +/// the cursor position pub fn auto_import_text_edit( // Ideally the position of the cursor, used to position: &SyntaxNode, @@ -39,6 +37,19 @@ pub fn auto_import_text_edit( } } +// Assist: add_import +// +// Adds a use statement for a given fully-qualified path. +// +// ``` +// fn process(map: std::collections::<|>HashMap) {} +// ``` +// -> +// ``` +// use std::collections::HashMap; +// +// fn process(map: HashMap) {} +// ``` pub(crate) fn add_import(ctx: AssistCtx) -> Option { let path: ast::Path = ctx.find_node_at_offset()?; // We don't want to mess with use statements -- cgit v1.2.3