How to set the python version in the LSP configuration? #15331
Replies: 1 comment
-
We've currently only exposed a certain subset of settings which can be directly altered from an editor,
Can you say more about this to help me understand why it isn't possible to provide the target version in the config file? Would specifying the minimum supported Python version as the target version help? Alternatively, you could have a separate config file specifically for editor context which only specifies the |
Beta Was this translation helpful? Give feedback.
-
I'd like to provide a default python version (3.13) for
ruff server
to use when running in my editor (neovim) thoughnvim-lspconfig
.I don't see anything like
target-version
here: https://docs.astral.sh/ruff/editors/settings/ and adding--config "target-version = 'py313'"
doesn't seem to have an effect, though I'm not exactly sure where that should go. I've gone through the docs but betweenruff_lsp
being deprecated and this sitting at the intersection ofruff server
andnvim-lspconfig
I wasn't able to find an obvious solution.Ruff's configuration in lspconfig is described here: https://github.com/neovim/nvim-lspconfig/blob/master/doc/configs.md#ruff but it says "Refer to the documentation for more details" in reference to the settings. That link takes me to https://docs.astral.sh/ruff/editors/ which lists a bunch of options but none for the
target-version
.We have a ruff.toml file in our repository but because we support multiple versions of Python that share this config file, I don't think I can can put
py313
there specifically.Thanks in advance for reading and any advice you might have!
Beta Was this translation helpful? Give feedback.
All reactions