-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Allow to pass the FileMode options in the vim plugin #1319
Conversation
The vim plugin takes now into consideration the `target-version` value of the `pyproject.toml` file. You can also specify a default target version with the configuration variable `g:black_target_version`. Vim's `:Black` command accepts now the following optional arguments: - `line_length` - `string_normalization` - `black_target_version` Those allow you to override any settings that come either from vim's configuration or the `pyproject.toml` file. It also supports supports a simple tab completion to allow to pass the arguments quicky.
I didn't realize that it was a boolan value.
Sorry for leaving this waiting for so long! There are a few merge conflicts now. Do we still need this change? |
Hi
I'd say yes, because This PR would allow you to do the following in vim: Plug 'shaoran/black', { 'branch': 'allow_override_args_19.10b0' } It's so long since I've created this PR that my changes might now work anymore, I'd have to check them, but I'll have time to do it at the weekend. |
If I may, I'll provide a review posted on our Discord in these messages: 1, 2 by Godlygeek: The core issue seems to be whether or not we'd like to be able to pass arguments as comma-separated
Without knowing too much about the plugin system, I do share these concerns. Target version is of course one argument whose value is naturally varied. Could you comment a bit on your view on the matter, @shaoran? Much appreciated! |
@felix-hilden I'm sorry, I have been very busy this week and was not able to reply. I cannot at the moment, but soon I will answer your questions. |
Hi @shaoran, any updates on this? It'd be nice to bring this issue closer to the finish! |
@felix-hilden I'm so sorry, I've forgotten about this. I'll try to take a look tomorrow or during the next week. |
@felix-hilden I tried merging Is the documentation source code for readthedocs still in the repository? |
It changed a lot, I basically would have to rewrite the whole thing again. OK, I'll try that. |
Yep, the documentation source is in the |
Ok. this will take me a little bit longer. Since there are so many changes since I created the pull request, all my changes are useless and basically have to write them again. I hope, tomorrow I can push a new version. |
No worries! And I'd also like to remind you about the review points I left above 😃 |
@felix-hilden sorry that it took a while, but I've been very busy at work. I try to address the concerns here
I made a change so that arguments are space-separated.
Yes, that is true, that's why I removed passing the other options like I maintain a python library that targets multiple python version, some modules only work with Py27, some with Py36, etc. Very often I have those files open at the same time and I'd like to format one with py27 as target and the other with py36 as target without having to set up variables and special rules in my config. So that's why it is for me more convenient to just pass Like I said before, I already use this on my environment and has been a huge time saver. CI seems to be failing because of changelog / Changelog Entry Check (pull_request). Clicking on Details reveals that I should add Please add '(#1319)' change line to CHANGES.md but I'm not sure I should be the one adding this line, besides I don't even know under which release this pull request would be merged (if accepted). So do I have to add that line, or do you do that? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the updates! Having target_version
as an argument makes total sense to me as well 👍 I had a look at the code and it looks reasonable, although I don't know vim plugins.
Our changelog is currently at the release, so a new heading needs to be added to the top. So please add a new ## Unreleased
heading and place the change under ### Integrations
. I left one comment as well. Since we're short on vim wizards, I'm willing to take your word on this working just fine 😄
docs/integrations/editors.md
Outdated
@@ -116,6 +116,8 @@ Wing supports black via the OS Commands tool, as explained in the Wing documenta | |||
Commands and shortcuts: | |||
|
|||
- `:Black` to format the entire file (ranges not supported); | |||
- you can optionally pass `target_version=<version>` where `<version>` is one of | |||
`[py27, py36, py37, py38, py39]` to set the target version. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also: we should probably not advertise specific versions here. I mean it's fine, but seems like another place to eventually get stale as we add support and drop support for older versions. Should be fine just to mention that it's the same argument as in the CLI, right? It would be a bit of an indirection though. Thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be fine just to mention that it's the same argument as in the CLI, right?
Yes, that would be better, and because of TAB completion, you get the correct list anyway. I'll change that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice 👌
in the command line
to make CI happy
if no target verison is found
So, what is the status of this merge request? Is it going to be merged? |
I'd say yes, but sadly I don't have commit access to the repo. I think if you agree that the conversation is resolved it's only a matter of time 👌 |
I hope so. Yesterday I had to merge it again with upstream because it was showing once again conflicts with upstream (luckily on the changelog). I'm afraid, that if it takes again weeks or even months (like when I created the pull request), my changes will be once again completely outdated and I would have to do it from scratch again. |
I feel you, sadly sometimes we're busy doing other things. But I'll try to push this to get resolved, and since it is pretty much done and big overhauls aren't planned, I think we're good 👍 |
The vim plugin takes now into consideration the
target-version
value ofthe
pyproject.toml
file.You can also specify a default target version with the configuration
variable
g:black_target_version
.Vim's
:Black
command accepts now the following optional arguments:line_length
string_normalization
black_target_version
Those allow you to override any settings that come either from vim's
configuration or the
pyproject.toml
file.It also supports supports a simple tab completion to allow to pass the
arguments quicky.