Comments (4)
As a workaround, if you set (setq lsp-pyright-multi-root nil)
then it'll run separate processes. You need to set that before you (require 'lsp-pyright)
, and may need to lsp-workspace-folders-remove
your existing folders. You can check whether this is working if lsp-describe-session
shows different port numbers for the different pyright instances.
from lsp-pyright.
I'm having the exact same issue using pyenv-mode
. Did you find a solution?
After some digging and trying to manually set lsp-pyright-venv-path
that is used in lsp-pyright-locate-python
I still can't make it work.
It seems like there's only 1 workspace created, e.g. if I open a file then LSP reports that:
LSP :: pyright:972173 initialized successfully in folders: (/home/user/project1 /home/user/project2 /home/user/.pyenv)
then if I open another file from the other project:
LSP :: Connected to [pyright:972173]
Is that correct?
Here it says that the server will ask for configs for each workspace, but that doesn't seem to happen.
from lsp-pyright.
I'm running into the same issue. Setting (setq lsp-pyright-multi-root nil)
early in my config does not seem to help. I removed all workspace folders as started from scratch. Looks like each time I switch into a new project, it gets "appended" to the session from the first virtual environment.
from lsp-pyright.
Hope this helps someone:
I don't fully understand why, but I found that I had to set the python.pythonPath
setting of pyright correctly for each project (virtualenv):
(setq lsp-pyright-multi-root nil) ; Must be set before lsp-pyright is loaded. https://github.com/emacs-lsp/lsp-pyright/issues/19#issuecomment-930596080
(defvar lsp-client-settings (make-hash-table :test 'equal)) ; Original does not set :test, so values with string keys cannot be replaced.
(use-package lsp-pyright
:ensure t
:config
(lsp-register-custom-settings
'(("python.pythonPath" ljosa-lsp-pyright-locate-python)))
(define-key lsp-mode-map (kbd "C-c C-l") lsp-command-map)
:hook (python-mode . (lambda ()
(require 'lsp-pyright)
(lsp))))
I also had to make sure that projectile understood that the virutalenv were in diferent projects. (This was relevant because they were in the same git repo.) I did this by creating empty .projectile
files in the root of each project.
After this, it still doesn't work at first: I have to do M-x lsp-reload-session
the first time I open a file in a new project (virtualenv).
from lsp-pyright.
Related Issues (20)
- How specify Python interpreter with elisp HOT 3
- Documentation not working HOT 5
- How can I change the pyright's initialized folder path? HOT 4
- How to unimport or remove an imported folder? HOT 1
- Is it possible to expose reveal_type on selection?
- wrong-type-argument hash-table-p on pyright startup HOT 5
- _T@abs error
- How to turn on foldingRange HOT 1
- lsp-mode doesn't seem to try to load pyright when opening python file HOT 4
- Request: Support for `python-ts-mode` HOT 1
- Auto import not working anymore HOT 2
- Inconsistent/random/non-deterministic choice of variable faces
- stub file not read when checking buffer HOT 1
- [Bug] lsp-request: Timeout while waiting for response HOT 1
- Emacs lsp-pyright can not complete print function HOT 2
- support multiple venvs in a monorepo
- Why is textDocument/implementation not implemented?
- How to set PYTHONPATH for python shell based on project root?
- (🎁) Support basedpyright
- lsp-pyright server crashes HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lsp-pyright.