mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 21:05:02 +00:00
Merge pull request #18551 from ShoyuVanilla/migrate-turbofish-assist
Migrate `add_turbo_fish` to `SyntaxEditor`
This commit is contained in:
commit
4b350f2f11
2 changed files with 77 additions and 24 deletions
|
@ -133,4 +133,22 @@ impl SyntaxFactory {
|
|||
|
||||
ast
|
||||
}
|
||||
|
||||
pub fn turbofish_generic_arg_list(
|
||||
&self,
|
||||
args: impl IntoIterator<Item = ast::GenericArg> + Clone,
|
||||
) -> ast::GenericArgList {
|
||||
let ast = make::turbofish_generic_arg_list(args.clone()).clone_for_update();
|
||||
|
||||
if let Some(mut mapping) = self.mappings() {
|
||||
let mut builder = SyntaxMappingBuilder::new(ast.syntax().clone());
|
||||
builder.map_children(
|
||||
args.into_iter().map(|arg| arg.syntax().clone()),
|
||||
ast.generic_args().map(|arg| arg.syntax().clone()),
|
||||
);
|
||||
builder.finish(&mut mapping);
|
||||
}
|
||||
|
||||
ast
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue