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
elisp emacs emacs-lisp lsp python

lsp-pyright

Build Status License MELPA Join the chat at https://gitter.im/emacs-lsp/lsp-mode

Table of Contents

lsp-mode client leveraging pyright and basedpyright language server.

Quickstart

(use-package lsp-pyright
  :ensure t
  :custom (lsp-pyright-langserver-command "pyright") ;; or basedpyright
  :hook (python-mode . (lambda ()
                          (require 'lsp-pyright)
                          (lsp))))  ; or lsp-deferred

Configuration

lsp-pyright supports the following configuration. Each configuration is described in detail in Pyright Settings.

Projects can be further configured using pyrightconfig.json file. For further details please see Pyright Configuration.

Choosing the correct version of Python

lsp-pyright will try its best to select the correct version of the python executable to use. It will do so by iteratively executing different search functions, going from most precise to most general.

The list and order of the list can be modified by customizing lsp-pyright-python-search-functions. By default the order is: