Support rust visibility for enum and others
This commit is contained in:
parent
8df5621334
commit
ebe7f82bb2
|
@ -148,7 +148,7 @@ define-command -hidden rust-indent-on-new-line %~
|
||||||
} catch %`
|
} catch %`
|
||||||
# re-indent previous line if it starts with where to match previous block
|
# re-indent previous line if it starts with where to match previous block
|
||||||
# string literal parsing within extern does not handle escape
|
# string literal parsing within extern does not handle escape
|
||||||
try %% execute-keys -draft k <a-x> <a-k> ^\h*where\b <ret> hh <a-?> ^\h*\b(impl|(|pub\ |pub\((crate|self|super|in\ (::)?([a-zA-Z][a-zA-Z0-9_]*|_[a-zA-Z0-9_]+)(::[a-zA-Z][a-zA-Z0-9_]*|_[a-zA-Z0-9_]+)*)\)\ )(async\ |const\ )?(unsafe\ )?(extern\ ("[^"]*"\ )?)?fn|struct|enum|union)\b <ret> <a-S> 1<a-&> %
|
try %% execute-keys -draft k <a-x> <a-k> ^\h*where\b <ret> hh <a-?> ^\h*\b(impl|((|pub\ |pub\((crate|self|super|in\ (::)?([a-zA-Z][a-zA-Z0-9_]*|_[a-zA-Z0-9_]+)(::[a-zA-Z][a-zA-Z0-9_]*|_[a-zA-Z0-9_]+)*)\)\ )((async\ |const\ )?(unsafe\ )?(extern\ ("[^"]*"\ )?)?fn|struct|enum|union)))\b <ret> <a-S> 1<a-&> %
|
||||||
# preserve previous line indent
|
# preserve previous line indent
|
||||||
try %{ execute-keys -draft <semicolon> K <a-&> }
|
try %{ execute-keys -draft <semicolon> K <a-&> }
|
||||||
# indent after lines ending with [{([].+ and move first parameter to own line
|
# indent after lines ending with [{([].+ and move first parameter to own line
|
||||||
|
@ -180,7 +180,7 @@ define-command -hidden rust-indent-on-opening-curly-brace %[
|
||||||
# align indent with opening paren when { is entered on a new line after the closing paren
|
# align indent with opening paren when { is entered on a new line after the closing paren
|
||||||
try %[ execute-keys -draft h <a-F> ) M <a-k> \A\(.*\)\h*\n\h*\{\z <ret> s \A|.\z <ret> 1<a-&> ]
|
try %[ execute-keys -draft h <a-F> ) M <a-k> \A\(.*\)\h*\n\h*\{\z <ret> s \A|.\z <ret> 1<a-&> ]
|
||||||
# dedent standalone { after impl and related block without any { in between
|
# dedent standalone { after impl and related block without any { in between
|
||||||
try %@ execute-keys -draft hh <a-?> ^\h*\b(impl|(|pub\ |pub\((crate|self|super|in\ (::)?([a-zA-Z][a-zA-Z0-9_]*|_[a-zA-Z0-9_]+)(::[a-zA-Z][a-zA-Z0-9_]*|_[a-zA-Z0-9_]+)*)\)\ )(async\ |const\ )?(unsafe\ )?(extern\ ("[^"]*"\ )?)?fn|struct|enum|union|if|for)\b <ret> <a-K> \{ <ret> <a-semicolon> <semicolon> ll <a-x> <a-k> ^\h*\{$ <ret> <a-lt> @
|
try %@ execute-keys -draft hh <a-?> ^\h*\b(impl|((|pub\ |pub\((crate|self|super|in\ (::)?([a-zA-Z][a-zA-Z0-9_]*|_[a-zA-Z0-9_]+)(::[a-zA-Z][a-zA-Z0-9_]*|_[a-zA-Z0-9_]+)*)\)\ )((async\ |const\ )?(unsafe\ )?(extern\ ("[^"]*"\ )?)?fn|struct|enum|union))|if|for)\b <ret> <a-K> \{ <ret> <a-semicolon> <semicolon> ll <a-x> <a-k> ^\h*\{$ <ret> <a-lt> @
|
||||||
~
|
~
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,11 @@
|
||||||
T: Debug
|
T: Debug
|
||||||
%( )
|
%( )
|
||||||
|
|
||||||
|
pub(crate) struct X<T>
|
||||||
|
where
|
||||||
|
T: Debug
|
||||||
|
%( )
|
||||||
|
|
||||||
struct X<T> where T: Debug %( )
|
struct X<T> where T: Debug %( )
|
||||||
|
|
||||||
enum X<T>
|
enum X<T>
|
||||||
|
|
|
@ -27,6 +27,11 @@
|
||||||
T: Debug
|
T: Debug
|
||||||
{
|
{
|
||||||
|
|
||||||
|
pub(crate) struct X<T>
|
||||||
|
where
|
||||||
|
T: Debug
|
||||||
|
{
|
||||||
|
|
||||||
struct X<T> where T: Debug {
|
struct X<T> where T: Debug {
|
||||||
|
|
||||||
enum X<T>
|
enum X<T>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user