Skip to content

Pyright not respecting g:WorkspaceFolders #851

@cheog

Description

@cheog

What's the output of :CocCommand pyright.version
coc-pyright 1.1.280 with Pyright 1.1.280

What's the output of :CocCommand workspace.showOutput Pyright

Workspace: /home/me/scratch/monorepo/application
Using python from dist/export/python/virtualenvs/python-default/3.10.2/bin/python

[Info  - 2:28:22 PM] Pyright language server 1.1.280 starting
[Info  - 2:28:22 PM] Server root directory: /home/me/.config/coc/extensions/node_modules/coc-pyright/node_modules/pyright/dist/
[Info  - 2:28:22 PM] Starting service instance "application"
[Info  - 2:28:22 PM] Starting service instance "library"
[Info  - 2:28:22 PM] Starting service instance "service"
[Info  - 2:28:23 PM] Starting service instance "<default>"
[Info  - 2:28:23 PM] No configuration file found.
[Info  - 2:28:23 PM] No pyproject.toml file found.
[Info  - 2:28:23 PM] Setting pythonPath for service "application": "/home/me/scratch/monorepo/application/dist/export/python/virtualenvs/python-default/3.10.2/bin/python"
[Warn  - 2:28:23 PM] stubPath /home/me/scratch/monorepo/application/typings is not a valid directory.
[Info  - 2:28:23 PM] Unable to get Python version from interpreter
[Info  - 2:28:23 PM] Assuming Python platform Linux
[Info  - 2:28:23 PM] Searching for source files
[Info  - 2:28:23 PM] Found 4 source files
[Info  - 2:28:23 PM] No configuration file found.
[Info  - 2:28:23 PM] No pyproject.toml file found.
[Info  - 2:28:23 PM] Setting pythonPath for service "library": "/home/me/scratch/monorepo/library/dist/export/python/virtualenvs/python-default/3.10.2/bin/python"
[Warn  - 2:28:23 PM] stubPath /home/me/scratch/monorepo/library/typings is not a valid directory.
[Info  - 2:28:23 PM] Unable to get Python version from interpreter
[Info  - 2:28:23 PM] Assuming Python platform Linux
[Info  - 2:28:23 PM] Searching for source files
[Info  - 2:28:23 PM] Found 4 source files
[Info  - 2:28:23 PM] No configuration file found.
[Info  - 2:28:23 PM] No pyproject.toml file found.
[Info  - 2:28:23 PM] Setting pythonPath for service "service": "/home/me/scratch/monorepo/service/dist/export/python/virtualenvs/python-default/3.10.2/bin/python"
[Warn  - 2:28:23 PM] stubPath /home/me/scratch/monorepo/service/typings is not a valid directory.
[Info  - 2:28:23 PM] Unable to get Python version from interpreter
[Info  - 2:28:23 PM] Assuming Python platform Linux
[Info  - 2:28:23 PM] Searching for source files
[Info  - 2:28:23 PM] Found 4 source files
[Info  - 2:28:23 PM] No pyproject.toml file found.
[Info  - 2:28:23 PM] Setting pythonPath for service "<default>": "/home/me/scratch/monorepo/application/dist/export/python/virtualenvs/python-default/3.10.2/bin/python"
[Warn  - 2:28:23 PM] stubPath typings is not a valid directory.
[Info  - 2:28:23 PM] Unable to get Python version from interpreter
[Info  - 2:28:23 PM] Assuming Python platform Linux
[Info  - 2:28:23 PM] Searching for source files
[Info  - 2:28:23 PM] No source files found.

Issue

I'm testing a monorepo layout and I can't get pyright to understand where all the roots are.

Details

My repo (tree below) has three major parts: application, library, and service. Each of these is supposed to be kind of self contained with it's own tests, readme, documentation etc.

I have a bit of vimscript that sets g:WorkspaceFolders to be ["/home/me/scratch/monorepo/application", "/home/me/scratch/monorepo/library", "/home/me/scratch/monorepo/service"]. This script runs after I set the keybindings and settings of CoC. However, as you can tell by the logs, it's not using these folders. How do I manually set the workspace folders?

I do not want to use the root_pattern stuff for two reasons:

  1. There isn't a usable root pattern.
  2. Even if there was (like if I did a touch .root in every root folder), it doesn't acknowledge all the roots unless I have at least one file per root open.
.
├── application
│   ├── application
│   │   ├── __init__.py
│   │   └── main.py
│   ├── README.md
│   └── tests
│       ├── __init__.py
│       └── test_application.py
├── default.lock
├── library
│   ├── library
│   │   ├── __init__.py
│   │   └── main.py
│   ├── README.md
│   └── tests
│       ├── __init__.py
│       └── test_library.py
├── pants
├── pants-plugins
│   └── version_from_git
│       ├── __pycache__
│       └── register.py
├── pants.toml
├── pyproject.toml
├── README.md
├── requirements.txt
└── service
    ├── README.md
    ├── service
    │   ├── __init__.py
    │   └── main.py
    └── tests
        ├── __init__.py
        └── test_service.py

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions