palantir / python-language-server

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

Add formatter options support for yapf #946

Closed masad-frost closed 2 years ago

masad-frost commented 2 years ago

resolves https://github.com/palantir/python-language-server/issues/328

This PR adds support for LSP formatting options https://microsoft.github.io/language-server-protocol/specifications/specification-3-17/#formattingOptions

It adds explicit support for tabSize and insertSpaces, the rest of the options are not configurable in yapf. I did however add support for arbitrary configurations as specified in [key: string]: boolean | integer | string;.

I think this PR might break plugins as the API now passes options to formatter hooks

masad-frost commented 2 years ago

closing in favor of https://github.com/python-lsp/python-lsp-server/pull/134 since this repo is not maintained