nvim: Ensure pythonPath setting always finds entry
LSP attachment would complain if it did not find an existing dict to access in the `settings.python` section of the python lsp dictionaries. This fixes that by creating an empty dict if nothing exists yet, essentially functioning as null-check.
This commit is contained in:
parent
b37650ac03
commit
4697e09472
1 changed files with 2 additions and 0 deletions
|
@ -168,6 +168,7 @@ lspconfig.pyright.setup({
|
|||
python_path, _ = require("core.util").get_python_venv(client.config.root_dir)
|
||||
end
|
||||
-- print(string.format("[PYTHON VENV]: %s", vim.inspect(python_path)))
|
||||
client.config.settings.python = {} or client.config.settings.python
|
||||
client.config.settings.python.pythonPath = python_path
|
||||
on_attach(client, bufnr)
|
||||
end,
|
||||
|
@ -178,6 +179,7 @@ lspconfig.ruff_lsp.setup({
|
|||
if python_path == nil then
|
||||
python_path, _ = require("core.util").get_python_venv(client.config.root_dir)
|
||||
end
|
||||
client.config.settings.python = {} or client.config.settings.python
|
||||
client.config.settings.python.pythonPath = python_path
|
||||
end,
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue