diff --git a/rc/filetype/rust.kak b/rc/filetype/rust.kak index cb97aaa7..d4016fd4 100644 --- a/rc/filetype/rust.kak +++ b/rc/filetype/rust.kak @@ -157,8 +157,8 @@ define-command -hidden rust-indent-on-new-line %~ try %< execute-keys -draft k s [^\h].+ \A[-+*/&|^})#] [,{](\h*/[/*].*|)$ j > # indent after lines ending with { try %< execute-keys -draft k \{$ j > - # dedent after lines starting with . and ending with } or ) or , or ; - try %_ execute-keys -draft k ^\h*\..*[}),]\h*$ j _ + # dedent after lines starting with . and ending with } or ) or , or ; or .await + try %_ execute-keys -draft k ^\h*\. ([}),]|\.await)\h*$ j _ # align to opening curly brace or paren when newline is inserted before a single closing try %< execute-keys -draft ^\h*[)}] h m 1 > # todo dedent additional unmatched parenthesis diff --git a/test/indent/rust/dedent-async/cmd b/test/indent/rust/dedent-async/cmd new file mode 100644 index 00000000..8682d51e --- /dev/null +++ b/test/indent/rust/dedent-async/cmd @@ -0,0 +1 @@ +cbar diff --git a/test/indent/rust/dedent-async/in b/test/indent/rust/dedent-async/in new file mode 100644 index 00000000..19fba70f --- /dev/null +++ b/test/indent/rust/dedent-async/in @@ -0,0 +1,5 @@ + foo() + .await%( ) + + foo().await%( ) + diff --git a/test/indent/rust/dedent-async/out b/test/indent/rust/dedent-async/out new file mode 100644 index 00000000..3ed467d8 --- /dev/null +++ b/test/indent/rust/dedent-async/out @@ -0,0 +1,7 @@ + foo() + .await + bar + + foo().await + bar + diff --git a/test/indent/rust/dedent-async/rc b/test/indent/rust/dedent-async/rc new file mode 100644 index 00000000..64064c25 --- /dev/null +++ b/test/indent/rust/dedent-async/rc @@ -0,0 +1,3 @@ +source "%val{runtime}/colors/default.kak" +source "%val{runtime}/rc/filetype/rust.kak" +set buffer filetype rust