Skip to content

add async/await syntax #627

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jan 11, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions doc/pymode.txt
Original file line number Diff line number Diff line change
Expand Up @@ -628,6 +628,10 @@ Highlight "print" as a function *'g:pymode_syntax_print_as_function'*
>
let g:pymode_syntax_print_as_function = 0

Highlight "async/await" keywords *'g:pymode_syntax_highlight_async_await'*
>
let g:pymode_syntax_highlight_async_await = g:pymode_syntax_all

Highlight '=' operator *'g:pymode_syntax_highlight_equal_operator'*
>
let g:pymode_syntax_highlight_equal_operator = g:pymode_syntax_all
Expand Down
10 changes: 10 additions & 0 deletions syntax/python.vim
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ call pymode#default('g:pymode_syntax_all', 1)

" Highlight 'print' as function
call pymode#default("g:pymode_syntax_print_as_function", 0)
"
" Highlight 'async/await' keywords
call pymode#default("g:pymode_syntax_highlight_async_await", g:pymode_syntax_all)

" Highlight '=' operator
call pymode#default('g:pymode_syntax_highlight_equal_operator', g:pymode_syntax_all)
Expand Down Expand Up @@ -101,6 +104,13 @@ endif
syn keyword pythonStatement print
endif

if g:pymode_syntax_highlight_async_await
syn keyword pythonStatement async await
syn match pythonStatement "\<async\s\+def\>" nextgroup=pythonFunction skipwhite
syn match pythonStatement "\<async\s\+with\>" display
syn match pythonStatement "\<async\s\+for\>" nextgroup=pythonRepeat skipwhite
endif

if g:pymode_syntax_highlight_equal_operator
syn match pythonExtraOperator "\%(=\)"
endif
Expand Down
1 change: 1 addition & 0 deletions t/syntax.vim
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ describe 'pymode-syntax'
Expect g:pymode_syntax == 1
Expect g:pymode_syntax_all == 1
Expect g:pymode_syntax_print_as_function == 0
Expect g:pymode_syntax_highlight_async_await == 1
Expect g:pymode_syntax_highlight_equal_operator == 1
Expect g:pymode_syntax_highlight_stars_operator == 1
Expect g:pymode_syntax_highlight_self == 1
Expand Down