mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 06:11:35 +00:00
pit-of-successify tree editor
This commit is contained in:
parent
34555593ca
commit
186a430853
2 changed files with 17 additions and 14 deletions
|
@ -102,17 +102,17 @@ impl GenericParamsOwnerEdit for ast::Enum {
|
|||
fn create_where_clause(position: Position) {
|
||||
let where_clause: SyntaxElement =
|
||||
make::where_clause(empty()).clone_for_update().syntax().clone().into();
|
||||
ted::insert_ws(position, where_clause);
|
||||
ted::insert(position, where_clause);
|
||||
}
|
||||
|
||||
impl ast::WhereClause {
|
||||
pub fn add_predicate(&self, predicate: ast::WherePred) {
|
||||
if let Some(pred) = self.predicates().last() {
|
||||
if !pred.syntax().siblings_with_tokens(Direction::Next).any(|it| it.kind() == T![,]) {
|
||||
ted::append_child(self.syntax().clone(), make::token(T![,]));
|
||||
ted::append_child_raw(self.syntax().clone(), make::token(T![,]));
|
||||
}
|
||||
}
|
||||
ted::append_child_ws(self.syntax().clone(), predicate.syntax().clone())
|
||||
ted::append_child(self.syntax().clone(), predicate.syntax().clone())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue