Skip to content

Commit f7220e4

Browse files
committed
Disable pyenv integration for pyls by default. Add checks before calling pyenv
1 parent 699ef49 commit f7220e4

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

lsp-pyls.el

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ parameters referenced in config."
353353
:group 'lsp-pyls
354354
:package-version '(lsp-mode . "6.3"))
355355

356-
(defcustom lsp-pyls-plugins-jedi-use-pyenv-environment t
356+
(defcustom lsp-pyls-plugins-jedi-use-pyenv-environment nil
357357
"If enabled, pass the environment got by pyenv to jedi"
358358
:type 'boolean
359359
:group 'lsp-pyls
@@ -378,12 +378,17 @@ should be the python executable. This option will be prioritized over
378378
(when root
379379
(setenv "PYENV_VERSION" nil)
380380
(let* ((pyenv-command-path (executable-find "pyenv"))
381-
(python-env (f-parent
382-
(f-parent
383-
(shell-command-to-string
384-
(format "PYENV_DIR='%s' %s which python"
385-
root pyenv-command-path))))))
386-
(lsp--info "Configure pyls with environment: %s" python-env)
381+
(python-env (when pyenv-command-path
382+
(f-parent
383+
(f-parent
384+
(shell-command-to-string
385+
(format "PYENV_DIR='%s' %s which python"
386+
root pyenv-command-path)))))))
387+
(if python-env (lsp--info "Configure pyls with environment: %s" python-env)
388+
(lsp--warn "Can't find the python environment for
389+
%s even if
390+
`lsp-pyls-plugins-jedi-use-pyenv-environment` is
391+
enabled") root)
387392
(setenv "PYENV_VERSION" pyenv-version)
388393
python-env))))))
389394

0 commit comments

Comments
 (0)