Format pyi files correctly (#599)

This commit is contained in:
Bryan Forbes 2019-02-04 21:08:06 -06:00 committed by Jelle Zijlstra
parent 66aa676278
commit a862795e1a

View File

@ -102,6 +102,8 @@ def Black():
mode = black.FileMode.AUTO_DETECT mode = black.FileMode.AUTO_DETECT
if bool(int(vim.eval("g:black_skip_string_normalization"))): if bool(int(vim.eval("g:black_skip_string_normalization"))):
mode |= black.FileMode.NO_STRING_NORMALIZATION mode |= black.FileMode.NO_STRING_NORMALIZATION
if vim.current.buffer.name.endswith('.pyi'):
mode |= black.FileMode.PYI
buffer_str = '\n'.join(vim.current.buffer) + '\n' buffer_str = '\n'.join(vim.current.buffer) + '\n'
try: try:
new_buffer_str = black.format_file_contents(buffer_str, line_length=line_length, fast=fast, mode=mode) new_buffer_str = black.format_file_contents(buffer_str, line_length=line_length, fast=fast, mode=mode)