Skip to content
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

Find pyproject from vim relative to current file #1871

Merged
merged 6 commits into from Jun 12, 2021
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGES.md
Expand Up @@ -12,6 +12,11 @@
- Fix incorrect custom breakpoint indices when string group contains fake f-strings
(#2311)

### Integrations

- The vim plugin now searches upwards from the directory containing the current buffer
instead of the current working directory for pyproject.toml. (#1871)

## 21.5b2

### _Black_
Expand Down
3 changes: 2 additions & 1 deletion autoload/black.vim
Expand Up @@ -139,7 +139,8 @@ def Black():
print(f'Reformatted in {time.time() - start:.4f}s.')

def get_configs():
path_pyproject_toml = black.find_pyproject_toml(vim.eval("fnamemodify(getcwd(), ':t')"))
filename = vim.eval("@%")
path_pyproject_toml = black.find_pyproject_toml((filename,))
if path_pyproject_toml:
toml_config = black.parse_pyproject_toml(path_pyproject_toml)
else:
Expand Down