I have neovim 0.8.0 installed.
I have neovim/nvim-lspconfig plugin installed.
I have installed pyright
language server on my system (pip install pyright
)
I have configured neovim to use the pyright
language server.
So now when I open a python file I get some warnings produced by pyright
. :LspInfo
command confirms that "1 client(s) attached to this buffer" and this client is pyright
.
So far so good. Now I start editing some code. For example I write the following function call:
x = get_value_of_x("aaaaaaaaaa", "bbbbbbb", "ccccccc",
"dddddddd")
As you can see this code is not properly formatted. According to pep8 rules it should be formatted like this:
x = get_value_of_x("aaaaaaaaaa", "bbbbbbb", "ccccccc",
"dddddddd")
I expected that neovim integrated with language server will automatically indent the code, but somehow it does not happen.
I tried to trigger format explicitly by executing the following command:
:lua vim.lsp.buf.format()
but get following error message: [LSP] Format request failed, no matching language servers.
I tried to install different language server ("jedi-language-server") instead of "pyright" - and the result is approximately the same: both servers function properly (for example "go to definition" functionality works fine) but not auto-formatting is available.
No log messages generated during these formatting attempts in ~/.cache/nvim/lsp.log
How can I configure nvim / lsp servers to properly indent python code?