From b0ae30a443291566164605a76419572b01961918 Mon Sep 17 00:00:00 2001 From: Ivan Tham Date: Sun, 4 Oct 2020 14:19:33 +0800 Subject: [PATCH] Add missing rust indent after function { --- rc/filetype/rust.kak | 2 ++ test/indent/rust/line-start-with-operator/in | 3 +++ test/indent/rust/line-start-with-operator/out | 4 ++++ 3 files changed, 9 insertions(+) diff --git a/rc/filetype/rust.kak b/rc/filetype/rust.kak index 9117de8e..cacc801a 100644 --- a/rc/filetype/rust.kak +++ b/rc/filetype/rust.kak @@ -155,6 +155,8 @@ define-command -hidden rust-indent-on-new-line %~ # indent after non-empty lines not starting with operator and not ending with , or ; # XXX simplify this into a single without s try %< execute-keys -draft k s [^\h].+ \A[-+*/&|^})#] [,](\h*/[/*].*|)$ j > + # addition to previous case where it starts with ) and ends with { + try %< execute-keys -draft k s [^\h].+ \A\) \{$ j > # dedent after lines starting with . and ending with } or ) or , or ; try %_ execute-keys -draft k ^\h*\..*[}),]\h*$ j _ # align to opening curly brace or paren when newline is inserted before a single closing diff --git a/test/indent/rust/line-start-with-operator/in b/test/indent/rust/line-start-with-operator/in index 063f771e..c1121942 100644 --- a/test/indent/rust/line-start-with-operator/in +++ b/test/indent/rust/line-start-with-operator/in @@ -26,3 +26,6 @@ #[derive(Debug)]%( ) + fn foo( + ) -> {%( ) + diff --git a/test/indent/rust/line-start-with-operator/out b/test/indent/rust/line-start-with-operator/out index f270d0d9..070561f5 100644 --- a/test/indent/rust/line-start-with-operator/out +++ b/test/indent/rust/line-start-with-operator/out @@ -40,3 +40,7 @@ #[derive(Debug)] bar + fn foo( + ) -> { + bar +