mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 04:44:57 +00:00
Make multiple import edits work for completions
This commit is contained in:
parent
046c85ef0c
commit
454ecd167c
17 changed files with 141 additions and 87 deletions
|
@ -41,7 +41,7 @@ impl Snippet {
|
|||
snippet: &[String],
|
||||
description: &[String],
|
||||
requires: &[String],
|
||||
scope: Option<SnippetScope>,
|
||||
scope: SnippetScope,
|
||||
) -> Option<Self> {
|
||||
// validate that these are indeed simple paths
|
||||
if requires.iter().any(|path| match ast::Path::parse(path) {
|
||||
|
@ -57,7 +57,7 @@ impl Snippet {
|
|||
let description = description.iter().join("\n");
|
||||
let description = if description.is_empty() { None } else { Some(description) };
|
||||
Some(Snippet {
|
||||
scope: scope.unwrap_or(SnippetScope::Expr),
|
||||
scope,
|
||||
label,
|
||||
snippet,
|
||||
description,
|
||||
|
@ -89,7 +89,7 @@ impl PostfixSnippet {
|
|||
snippet: &[String],
|
||||
description: &[String],
|
||||
requires: &[String],
|
||||
scope: Option<PostfixSnippetScope>,
|
||||
scope: PostfixSnippetScope,
|
||||
) -> Option<Self> {
|
||||
// validate that these are indeed simple paths
|
||||
if requires.iter().any(|path| match ast::Path::parse(path) {
|
||||
|
@ -105,7 +105,7 @@ impl PostfixSnippet {
|
|||
let description = description.iter().join("\n");
|
||||
let description = if description.is_empty() { None } else { Some(description) };
|
||||
Some(PostfixSnippet {
|
||||
scope: scope.unwrap_or(PostfixSnippetScope::Expr),
|
||||
scope,
|
||||
label,
|
||||
snippet,
|
||||
description,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue