From 2fbff6774c9eeebaa1c499626a3b60262417901b Mon Sep 17 00:00:00 2001 From: Yannick PEROUX Date: Wed, 30 Aug 2017 15:15:20 +0200 Subject: [PATCH 1/2] Add failing test case of selection of async statement --- test/selection.vader | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/test/selection.vader b/test/selection.vader index 97ef2ba..bb08a33 100644 --- a/test/selection.vader +++ b/test/selection.vader @@ -440,3 +440,33 @@ Expect python (innermost function replaced): def example(): x return example + + +Given python (async function): +========================================== + async def example(): + async with foo: + a + b + c + return 42 + +Do (replace inner block): +================================ + 3GciPx + +Expect python (innermost function replaced): +============================================ + async def example(): + async with foo: + x + return 42 + +Do (replace inner block): +================================ + ciPx + +Expect python (innermost function replaced): +============================================ + async def example(): + x From a53fb70d00e3c5a72a44331cdbab3f13443a7fcb Mon Sep 17 00:00:00 2001 From: Yannick PEROUX Date: Wed, 30 Aug 2017 15:15:38 +0200 Subject: [PATCH 2/2] Add support of selection of async statements --- autoload/braceless.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autoload/braceless.vim b/autoload/braceless.vim index 2c6c39e..45e8548 100644 --- a/autoload/braceless.vim +++ b/autoload/braceless.vim @@ -11,7 +11,7 @@ let s:pattern_cache = {} " Default patterns let s:pattern_default = {} let s:pattern_default.python = { - \ 'start': '\<\%(if\|def\|for\|try\|elif\|else\|with\|class\|while\|except\|finally\)\>\_.\{-}:\ze\s*\%(\_$\|#\)', + \ 'start': '\<\%(if\|async\|def\|for\|try\|elif\|else\|with\|class\|while\|except\|finally\)\>\_.\{-}:\ze\s*\%(\_$\|#\)', \ 'decorator': '\_^\s*@\%(\k\|\.\)\+\%((\_.\{-})\)\?\_$', \ 'end': '\S', \}