Dedent rust await function with ?
This commit is contained in:
parent
049591f6b4
commit
4e594e034a
|
@ -157,8 +157,8 @@ define-command -hidden rust-indent-on-new-line %~
|
||||||
try %< execute-keys -draft k <a-x> s [^\h].+ <ret> <a-K> \A[-+*/&|^})<gt><lt>#] <ret> <a-K> [,<semicolon>{](\h*/[/*].*|)$ <ret> j <a-gt> >
|
try %< execute-keys -draft k <a-x> s [^\h].+ <ret> <a-K> \A[-+*/&|^})<gt><lt>#] <ret> <a-K> [,<semicolon>{](\h*/[/*].*|)$ <ret> j <a-gt> >
|
||||||
# indent after lines ending with {
|
# indent after lines ending with {
|
||||||
try %< execute-keys -draft k <a-x> <a-k> \{$ <ret> j <a-gt> >
|
try %< execute-keys -draft k <a-x> <a-k> \{$ <ret> j <a-gt> >
|
||||||
# dedent after lines starting with . and ending with } or ) or , or ; or .await
|
# dedent after lines starting with . and ending with } or ) or , or ; or .await (} or ) or .await maybe with ?)
|
||||||
try %_ execute-keys -draft k <a-x> <a-k> ^\h*\. <ret> <a-k>([}),<semicolon>]|\.await)\h*$ <ret> j <a-lt> _
|
try %_ execute-keys -draft k <a-x> <a-k> ^\h*\. <ret> <a-k> ([,<semicolon>]|(([})]|\.await)\?*))\h*$ <ret> j <a-lt> _
|
||||||
# dedent after lines ending with " => {}" - part of empty match
|
# dedent after lines ending with " => {}" - part of empty match
|
||||||
try %# execute-keys -draft k <a-x> <a-k> \ =>\ \{\}\h*$ <ret> j <a-lt> #
|
try %# execute-keys -draft k <a-x> <a-k> \ =>\ \{\}\h*$ <ret> j <a-lt> #
|
||||||
# align to opening curly brace or paren when newline is inserted before a single closing
|
# align to opening curly brace or paren when newline is inserted before a single closing
|
||||||
|
|
|
@ -3,3 +3,6 @@
|
||||||
|
|
||||||
foo().await%( )
|
foo().await%( )
|
||||||
|
|
||||||
|
foo()
|
||||||
|
.await?%( )
|
||||||
|
|
||||||
|
|
|
@ -5,3 +5,7 @@
|
||||||
foo().await
|
foo().await
|
||||||
bar
|
bar
|
||||||
|
|
||||||
|
foo()
|
||||||
|
.await?
|
||||||
|
bar
|
||||||
|
|
||||||
|
|
|
@ -13,3 +13,7 @@ fn foo() -> i32 {
|
||||||
|
|
||||||
fn foo() -> i32 {
|
fn foo() -> i32 {
|
||||||
bar()%( )}
|
bar()%( )}
|
||||||
|
|
||||||
|
fn foo() -> i32 {
|
||||||
|
bar()?%( )}
|
||||||
|
|
||||||
|
|
|
@ -19,3 +19,8 @@ fn foo() -> i32 {
|
||||||
fn foo() -> i32 {
|
fn foo() -> i32 {
|
||||||
bar()
|
bar()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn foo() -> i32 {
|
||||||
|
bar()?
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,5 +27,8 @@
|
||||||
{(
|
{(
|
||||||
bar()%( ))}
|
bar()%( ))}
|
||||||
|
|
||||||
|
{(
|
||||||
|
bar()?%( ))}
|
||||||
|
|
||||||
{(
|
{(
|
||||||
bar()%( ))}
|
bar()%( ))}
|
||||||
|
|
|
@ -38,6 +38,10 @@
|
||||||
bar()
|
bar()
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
{(
|
||||||
|
bar()?
|
||||||
|
)}
|
||||||
|
|
||||||
{(
|
{(
|
||||||
bar()
|
bar()
|
||||||
)}
|
)}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user