Skip to content

Commit 08e1af3

Browse files
committed
fix: update ty settings via notify call
1 parent 71f6476 commit 08e1af3

1 file changed

Lines changed: 23 additions & 3 deletions

File tree

lua/python/lsp/init.lua

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,29 @@ PythonLSP.python_lsp_servers = {
6060
end,
6161
},
6262
ty = {
63-
callback = function(_, client)
64-
vim.notify_once(string.format("python.nvim: restart lsp client: '%s'", client.name), vim.log.levels.INFO)
65-
vim.cmd(":LspRestart ty")
63+
callback = function(venv_path, client)
64+
local new_settings = vim.tbl_deep_extend("force", client.settings, {
65+
pythonExtension = {
66+
activeEnvironment = {
67+
version = {
68+
major = 3,
69+
minor = 12,
70+
patch = 0,
71+
sysVersion = "3.12",
72+
},
73+
environment = {
74+
folderUri = "file://" .. vim.fs.joinpath(venv_path, "/bin/python"),
75+
uri = vim.fs.basename(venv_path),
76+
type = "VirtualEnvironment",
77+
},
78+
executable = {
79+
uri = "file://" .. vim.fs.joinpath(venv_path, "/bin/python"),
80+
sysPrefix = venv_path,
81+
},
82+
},
83+
},
84+
})
85+
call_did_change_configuration(client, new_settings)
6686
end,
6787
},
6888
-- For my homies in devops

0 commit comments

Comments
 (0)