From 4a83aae09849123dbbbc5726b07c2601a14397a8 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sat, 26 Oct 2019 19:58:18 +0300 Subject: support range selection in assist docs --- crates/ra_assists/src/assists/introduce_variable.rs | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'crates/ra_assists/src/assists') diff --git a/crates/ra_assists/src/assists/introduce_variable.rs b/crates/ra_assists/src/assists/introduce_variable.rs index 43378c4b0..8245dc99f 100644 --- a/crates/ra_assists/src/assists/introduce_variable.rs +++ b/crates/ra_assists/src/assists/introduce_variable.rs @@ -1,5 +1,3 @@ -//! FIXME: write short doc here - use format_buf::format; use hir::db::HirDatabase; use ra_syntax::{ @@ -14,6 +12,22 @@ use test_utils::tested_by; use crate::{Assist, AssistCtx, AssistId}; +// Assist: introduce_variable +// +// Extracts subexpression into a variable. +// +// ``` +// fn main() { +// <|>(1 + 2)<|> * 4; +// } +// ``` +// -> +// ``` +// fn main() { +// let var_name = (1 + 2); +// var_name * 4; +// } +// ``` pub(crate) fn introduce_variable(mut ctx: AssistCtx) -> Option { if ctx.frange.range.is_empty() { return None; -- cgit v1.2.3