lsp-pyright
lsp-pyright copied to clipboard
`lsp-pyright-venv-path` vs. `lsp-pyright-venv-directory`?
Yesterday's commit 3fd23f17ddff8d22115f7b0b9d3f4ed8fb90add3 added the option lsp-pyright-venv-directory, but there was already an option lsp-pyright-venv-path, which, judging by the description, has the same function.
BTW, both options have an incomplete :type spec. Since they can also be nil, the type should be something like this:
(defcustom lsp-pyright-venv-path nil
"Path to folder with subdirectories that contain virtual environments.
Virtual Envs specified in pyrightconfig.json will be looked up in this path."
:type '(choice (string :tag "Venv path")
(const :tag "No venv path" nil))
:group 'lsp-pyright)
That way, they are displayed correctly in the Customize buffer and can be properly type-checked.
lsp-pyright-venv-path is absolute path, while lsp-pyright-venv-directory is the folder name.
See:
(defun lsp-pyright-locate-venv ()
"Look for virtual environments local to the workspace."
(or lsp-pyright-venv-path
(and lsp-pyright-venv-directory
(-when-let (venv-base-directory (locate-dominating-file default-directory lsp-pyright-venv-directory))
(concat venv-base-directory lsp-pyright-venv-directory)))
(-when-let (venv-base-directory (locate-dominating-file default-directory "venv/"))
(concat venv-base-directory "venv"))
(-when-let (venv-base-directory (locate-dominating-file default-directory ".venv/"))
(concat venv-base-directory ".venv"))))
Ah, thanks for the clarification. Admittedly, I didn't look at the code, just at the doc strings, which didn't make the difference clear to me. If you would like, I could prepare a PR to suggest an update to the doc strings.
PR is welcome