palantir / python-language-server

An implementation of the Language Server Protocol for Python
MIT License
2.61k stars 283 forks source link

Support multiple formatters #847

Closed jzelinskie closed 4 years ago

jzelinskie commented 4 years ago

My end goal is to have isort and black both executing when "format document" is called. I think the best way to accomplish this is to specify an ordered list of formatters. If I was to implement this like a regular formatting plugin, would I have any issues? I assume there'd be a problem because @hookimpl would be executed when you import an existing formatter into the meta-formatter.

theHamsta commented 4 years ago

There's a a extension for isort. See 3rd party plugins in README.

jzelinskie commented 4 years ago

I could be mistaken, but it appears that either the isort plugin does not work (I've tried a branch both the pypi version and the git rev PRed for adding isort 5+ compatibility). If it did work, would pyls format with both? How would it know which to execute first?

theHamsta commented 4 years ago

Hi. I just tried it out. The extension seems to work only with isort==4.0.X. Nothing happens with isort==5.0.9. Then, it uses both formatters.

EDIT: latest working I found was 4.3.21

jzelinskie commented 4 years ago

pyls-isort appears to be updated and working. My bad for the confusion.