From 268e739c94d2e9edbb45374dfcc252b1648d3181 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 22 Apr 2019 13:01:33 +0300 Subject: move add_missing_members to structured editing API Currently, this is more code, and we also loose auto-indenting of bodies, but, long-term, this is the right approach --- crates/ra_syntax/src/ast/extensions.rs | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'crates/ra_syntax/src/ast') diff --git a/crates/ra_syntax/src/ast/extensions.rs b/crates/ra_syntax/src/ast/extensions.rs index 5c4c0ffc1..9cbd2c6b8 100644 --- a/crates/ra_syntax/src/ast/extensions.rs +++ b/crates/ra_syntax/src/ast/extensions.rs @@ -210,6 +210,15 @@ impl ast::EnumVariant { } } +impl ast::FnDef { + pub fn semicolon_token(&self) -> Option> { + self.syntax() + .last_child_or_token() + .and_then(|it| it.as_token()) + .filter(|it| it.kind() == SEMI) + } +} + impl ast::LetStmt { pub fn has_semi(&self) -> bool { match self.syntax().last_child_or_token() { -- cgit v1.2.3