mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 12:54:58 +00:00
Render the expansion of snippets as their docs
This commit is contained in:
parent
77cbf4adbc
commit
041cfbe0f4
4 changed files with 10 additions and 17 deletions
|
@ -1,5 +1,6 @@
|
|||
//! This file provides snippet completions, like `pd` => `eprintln!(...)`.
|
||||
|
||||
use hir::Documentation;
|
||||
use ide_db::helpers::{insert_use::ImportScope, SnippetCap};
|
||||
use syntax::T;
|
||||
|
||||
|
@ -109,7 +110,9 @@ fn add_custom_completions(
|
|||
Some(imports) => imports,
|
||||
None => return,
|
||||
};
|
||||
let mut builder = snippet(ctx, cap, &trigger, &snip.snippet());
|
||||
let body = snip.snippet();
|
||||
let mut builder = snippet(ctx, cap, &trigger, &body);
|
||||
builder.documentation(Documentation::new(format!("```rust\n{}\n```", body)));
|
||||
for import in imports.into_iter() {
|
||||
builder.add_import(import);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue