lsp-pyright icon indicating copy to clipboard operation
lsp-pyright copied to clipboard

Provide a way to change how the python executable is found

Open jtamagnan-delphix opened this issue 4 months ago • 1 comments

Problem

I've found it difficult to change which version of Python is in use. Right now it defaults to finding a parent .venv but I would rather it default to using the python executable that I've set.

Solution

To maintain backwards compatibility I've modified lsp-pyright-locate-python to support a new list of "locating" functions. These functions each return a python executable or nil when the search method fails. The order of functions defaults to what existed beforehand but now it is possible to customize that order by modifying lsp-pyright-python-search-functions.

Testing

I've tested the default configuration. It returned the cursed configuration that I did not want.

I also tested with

(setq lsp-pyright-python-search-functions
  '(lsp-pyright--locate-python-python))

which is what I've been using and intend on using

jtamagnan-delphix avatar Feb 20 '24 23:02 jtamagnan-delphix

@seagle0128 reaching out since from what I can tell you're the primary maintainer of this repository. Is this something you'd be able to look at? TIA

jtamagnan-delphix avatar Feb 21 '24 20:02 jtamagnan-delphix

@seagle0128, is there anything that I could do to help this along?

jtamagnan-delphix avatar Apr 15 '24 16:04 jtamagnan-delphix

Sorry for being late. Already merged.

seagle0128 avatar Apr 16 '24 06:04 seagle0128

@seagle0128 thanks for the review and sorry for the nags! I really appreciate the package and the support that you offer for it

jtamagnan-delphix avatar Apr 16 '24 15:04 jtamagnan-delphix