emacs-lsp / lsp-pyright

lsp-mode :heart: pyright
https://emacs-lsp.github.io/lsp-pyright
GNU General Public License v3.0
291 stars 25 forks source link

Provide a way to change how the python executable is found #89

Closed ghost closed 7 months ago

ghost commented 9 months ago

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

ghost commented 9 months ago

@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

ghost commented 7 months ago

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

seagle0128 commented 7 months ago

Sorry for being late. Already merged.

ghost commented 7 months ago

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