Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@
- Fix incorrect custom breakpoint indices when string group contains fake f-strings
(#2311)

### Integrations

- The vim plugin now reads the correct string normalization option in pyproject.toml
(#1869)
- The vim plugin no longer crashes Black when there's boolean values in pyproject.toml
(#1869)

## 21.5b2

### _Black_
Expand Down
6 changes: 3 additions & 3 deletions autoload/black.vim
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class Flag(collections.namedtuple("FlagBase", "name, cast")):
FLAGS = [
Flag(name="line_length", cast=int),
Flag(name="fast", cast=strtobool),
Flag(name="string_normalization", cast=strtobool),
Flag(name="skip_string_normalization", cast=strtobool),
Flag(name="quiet", cast=strtobool),
]

Expand Down Expand Up @@ -103,7 +103,7 @@ def Black():
configs = get_configs()
mode = black.FileMode(
line_length=configs["line_length"],
string_normalization=configs["string_normalization"],
string_normalization=not configs["skip_string_normalization"],
is_pyi=vim.current.buffer.name.endswith('.pyi'),
)
quiet = configs["quiet"]
Expand Down Expand Up @@ -146,7 +146,7 @@ def get_configs():
toml_config = {}

return {
flag.var_name: flag.cast(toml_config.get(flag.name, vim.eval(flag.vim_rc_name)))
flag.var_name: toml_config.get(flag.name, flag.cast(vim.eval(flag.vim_rc_name)))
for flag in FLAGS
}

Expand Down
8 changes: 4 additions & 4 deletions plugin/black.vim
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ endif
if !exists("g:black_linelength")
let g:black_linelength = 88
endif
if !exists("g:black_string_normalization")
if exists("g:black_skip_string_normalization")
let g:black_string_normalization = !g:black_skip_string_normalization
if !exists("g:black_skip_string_normalization")
if exists("g:black_string_normalization")
let g:black_skip_string_normalization = !g:black_string_normalization
else
let g:black_string_normalization = 1
let g:black_skip_string_normalization = 0
endif
endif
if !exists("g:black_quiet")
Expand Down