Skip to content

Commit fa0ff7d

Browse files
committed
Merge pull request python-mode#627 from andriykohut/async-await-syntax
add async/await syntax
2 parents fd70ac2 + 65e4ba9 commit fa0ff7d

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

doc/pymode.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -628,6 +628,10 @@ Highlight "print" as a function *'g:pymode_syntax_print_as_function'*
628628
>
629629
let g:pymode_syntax_print_as_function = 0
630630
631+
Highlight "async/await" keywords *'g:pymode_syntax_highlight_async_await'*
632+
>
633+
let g:pymode_syntax_highlight_async_await = g:pymode_syntax_all
634+
631635
Highlight '=' operator *'g:pymode_syntax_highlight_equal_operator'*
632636
>
633637
let g:pymode_syntax_highlight_equal_operator = g:pymode_syntax_all

syntax/python.vim

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ call pymode#default('g:pymode_syntax_all', 1)
1616

1717
" Highlight 'print' as function
1818
call pymode#default("g:pymode_syntax_print_as_function", 0)
19+
"
20+
" Highlight 'async/await' keywords
21+
call pymode#default("g:pymode_syntax_highlight_async_await", g:pymode_syntax_all)
1922

2023
" Highlight '=' operator
2124
call pymode#default('g:pymode_syntax_highlight_equal_operator', g:pymode_syntax_all)
@@ -101,6 +104,13 @@ endif
101104
syn keyword pythonStatement print
102105
endif
103106

107+
if g:pymode_syntax_highlight_async_await
108+
syn keyword pythonStatement async await
109+
syn match pythonStatement "\<async\s\+def\>" nextgroup=pythonFunction skipwhite
110+
syn match pythonStatement "\<async\s\+with\>" display
111+
syn match pythonStatement "\<async\s\+for\>" nextgroup=pythonRepeat skipwhite
112+
endif
113+
104114
if g:pymode_syntax_highlight_equal_operator
105115
syn match pythonExtraOperator "\%(=\)"
106116
endif

t/syntax.vim

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ describe 'pymode-syntax'
1313
Expect g:pymode_syntax == 1
1414
Expect g:pymode_syntax_all == 1
1515
Expect g:pymode_syntax_print_as_function == 0
16+
Expect g:pymode_syntax_highlight_async_await == 1
1617
Expect g:pymode_syntax_highlight_equal_operator == 1
1718
Expect g:pymode_syntax_highlight_stars_operator == 1
1819
Expect g:pymode_syntax_highlight_self == 1

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy