|
@@ -62,6 +62,18 @@ vim.lsp.config('ruby_lsp', {
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
vim.lsp.config('pyright', {
|
|
vim.lsp.config('pyright', {
|
|
|
|
|
+ before_init = function(_, config)
|
|
|
|
|
+ local git_root = vim.fn.FugitiveGitDir()
|
|
|
|
|
+ if git_root == '' then
|
|
|
|
|
+ return
|
|
|
|
|
+ end
|
|
|
|
|
+
|
|
|
|
|
+ -- if a venv is present, use it
|
|
|
|
|
+ local venv_path = vim.fn.finddir('.venv', '.;' .. git_root)
|
|
|
|
|
+ if venv_path ~= '' then
|
|
|
|
|
+ config.settings.python.pythonPath = vim.fs.joinpath(venv_path, 'bin', 'python')
|
|
|
|
|
+ end
|
|
|
|
|
+ end,
|
|
|
handlers = {
|
|
handlers = {
|
|
|
['$/progress'] = function()
|
|
['$/progress'] = function()
|
|
|
-- this is quite noisy so just disable it
|
|
-- this is quite noisy so just disable it
|