mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 13:25:09 +00:00
define syntax_editor_add_generic_param
Signed-off-by: Tarek <tareknaser360@gmail.com>
This commit is contained in:
parent
4af3d6f598
commit
642d4f3385
3 changed files with 34 additions and 7 deletions
|
@ -2,7 +2,7 @@
|
|||
use itertools::Itertools;
|
||||
|
||||
use crate::{
|
||||
ast::{self, make, HasName},
|
||||
ast::{self, make, HasName, HasTypeBounds},
|
||||
syntax_editor::SyntaxMappingBuilder,
|
||||
AstNode,
|
||||
};
|
||||
|
@ -15,7 +15,6 @@ impl SyntaxFactory {
|
|||
}
|
||||
|
||||
pub fn ty(&self, text: &str) -> ast::Type {
|
||||
// FIXME: Is there anything to map here?
|
||||
make::ty(text).clone_for_update()
|
||||
}
|
||||
|
||||
|
@ -29,6 +28,12 @@ impl SyntaxFactory {
|
|||
if let Some(mut mapping) = self.mappings() {
|
||||
let mut builder = SyntaxMappingBuilder::new(ast.syntax().clone());
|
||||
builder.map_node(name.syntax().clone(), ast.name().unwrap().syntax().clone());
|
||||
if let Some(input) = bounds {
|
||||
builder.map_node(
|
||||
input.syntax().clone(),
|
||||
ast.type_bound_list().unwrap().syntax().clone(),
|
||||
);
|
||||
}
|
||||
builder.finish(&mut mapping);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue