mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-02 22:54:58 +00:00
Allow merging of multiple selected imports.
The selected imports have to have a common prefix in paths. Before ```rust $0use std::fmt::Display; use std::fmt::Debug;$0 ``` After ```rust use std::fmt::{Display, Debug}; ```
This commit is contained in:
parent
88024c7ec2
commit
ea8899a445
2 changed files with 148 additions and 31 deletions
|
@ -30,6 +30,8 @@ impl MergeBehavior {
|
|||
}
|
||||
}
|
||||
|
||||
/// Merge `rhs` into `lhs` keeping both intact.
|
||||
/// Returned AST is mutable.
|
||||
pub fn try_merge_imports(
|
||||
lhs: &ast::Use,
|
||||
rhs: &ast::Use,
|
||||
|
@ -51,6 +53,8 @@ pub fn try_merge_imports(
|
|||
Some(lhs)
|
||||
}
|
||||
|
||||
/// Merge `rhs` into `lhs` keeping both intact.
|
||||
/// Returned AST is mutable.
|
||||
pub fn try_merge_trees(
|
||||
lhs: &ast::UseTree,
|
||||
rhs: &ast::UseTree,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue