-
Notifications
You must be signed in to change notification settings - Fork 284
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
Code formatting configuration #328
Comments
Yup, seems like YAPF might be a better default. Happy to revert the PR? |
Reverting the PR would be a good start but I'd love some configurability here. I do also have a horse in this race. |
So configuration can be passed by the client to the sever to disable/enable specific plugins. I’d prefer the client to handle this if possible. However it may make sense to try to enable/disable based on the presence of a yapf config file. It would be great if you could provide a plugin for that formatter by the way! Would be happy to take a PR or to help review a separate plugin (see pyls mypy) |
I'll submit a PR soon :-) |
@ambv How is your (black) horse pulling the request? Any chance to see that majestic creature in this stable? |
@vlcinsky Looks like someone else has already written a plugin: https://github.com/rupert/pyls-black |
@auscompgeek thanks for great reference. It is very fresh. My first test does not seem work, but I will retry after few more |
@ambv Any progress on configuration for code formatting than using a plugin? |
Up |
You need to enable or disable those plugins in order to leave a single formatter enabled at a time. That's how you can handle several formatters without installing/uninstalling them. |
@ccordoba12 How I can do that? I wan't use black |
You need to install the pyls-black plugin mentioned above, then configure your client to tell the server that autopep8 and yapf are disabled and that plugin is enabled. I can't give you more details because each client handles configuration in different ways, but it's usually done in through a json file, like this one: https://github.com/palantir/python-language-server/blob/develop/vscode-client/package.json |
Hi! Thanks for
pyls
, it's great.Historically, YAPF was the preferred formatter in
pyls
. This recently changed with #315 without a rationale provided (in fact the README still states the opposite). There's a few problems with this.I don't think defaulting to autopep8 is a great choice. YAPF's README provides a good explanation as to why.
It seems to me like the only option to configure an alternative formatter is to uninstall YAPF and/or autopep8 from the virtualenv?
It would be great if there was a way for people to configure which one they want, ideally on a per-project basis.
The text was updated successfully, but these errors were encountered: