question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

coc-pyright could not find pyrightconfig.json

See original GitHub issue

I have following project structure:

.
├── src
│  ├── app
│  │  ├── assets
│  │  │  └── test.js
│  │  ├── core
│  │  │  └── test.py
│  │  ├── __init__.py
│  │  ├── package-lock.json
│  │  ├── package.json
│  │  └── package.json
│  └── manage.py
├── poetry.lock
├── pyproject.toml
├── pyrightconfig.json
└── README.md

To reproduce issue, you need to have coc-tsserver and coc-pyright installed. Clone this example and open src/app/assets/test.js, and then src/app/core/test.js https://github.com/last-partizan/coc-project-dir-issue

Looks like coc-tsserver adds src/app to workspaceFolders, and coc-pyright uses first entry to look for pyrightconfig.json.

Output of :CocCommand workspace.workspaceFolders

/tmp/test-project-dir/src/app
/tmp/test-project-dir

What’s the output of :CocCommand pyright.version

[coc.nvim] coc-pyright 1.1.194 with Pyright 1.1.195

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

Workspace: /tmp/coc-project-dir-issue/src/app
Using python from /usr/bin/python

[Info  - 12:12:24 PM] Pyright language server 1.1.195 starting
[Info  - 12:12:24 PM] Server root directory: /home/serg/.config/coc/extensions/node_modules/coc-pyright/node_modules/pyright/dist/
[Info  - 12:12:24 PM] No configuration file found.
[Info  - 12:12:24 PM] No pyproject.toml file found.
[Info  - 12:12:24 PM] Setting pythonPath for service "app": "/usr/bin/python"
[Warn  - 12:12:24 PM] stubPath /tmp/coc-project-dir-issue/src/app/typings is not a valid directory.
[Info  - 12:12:24 PM] Assuming Python version 3.10
[Info  - 12:12:24 PM] Assuming Python platform Linux
[Warn  - 12:12:24 PM] Exception received when installing file system watcher: TypeError [ERR_FEATURE_UNAVAILABLE_ON_PLATFORM]: The feature watch recursively is unavailable on the current platform, which is being used to run Node.js
[Warn  - 12:12:24 PM] Exception received when installing file system watcher: TypeError [ERR_FEATURE_UNAVAILABLE_ON_PLATFORM]: The feature watch recursively is unavailable on the current platform, which is being used to run Node.js
[Warn  - 12:12:24 PM] Exception received when installing file system watcher: TypeError [ERR_FEATURE_UNAVAILABLE_ON_PLATFORM]: The feature watch recursively is unavailable on the current platform, which is being used to run Node.js
[Info  - 12:12:24 PM] Searching for source files
[Info  - 12:12:24 PM] Found 6 source files
[Info  - 12:12:24 PM] Setting pythonPath for service "coc-project-dir-issue": "/usr/bin/python"
[Info  - 12:12:24 PM] Loading configuration file at /tmp/coc-project-dir-issue/pyrightconfig.json
[Info  - 12:12:24 PM] Assuming Python version 3.10
[Info  - 12:12:24 PM] Assuming Python platform Linux
[Info  - 12:12:24 PM] No include entries specified; assuming /tmp/coc-project-dir-issue
[Info  - 12:12:24 PM] Auto-excluding **/node_modules
[Info  - 12:12:24 PM] Auto-excluding **/__pycache__
[Info  - 12:12:24 PM] Auto-excluding .git
[Warn  - 12:12:24 PM] stubPath /tmp/coc-project-dir-issue/typings is not a valid directory.
[Warn  - 12:12:24 PM] Exception received when installing file system watcher: TypeError [ERR_FEATURE_UNAVAILABLE_ON_PLATFORM]: The feature watch recursively is unavailable on the current platform, which is being used to run Node.js
[Warn  - 12:12:24 PM] Exception received when installing file system watcher: TypeError [ERR_FEATURE_UNAVAILABLE_ON_PLATFORM]: The feature watch recursively is unavailable on the current platform, which is being used to run Node.js
[Warn  - 12:12:24 PM] Exception received when installing file system watcher: TypeError [ERR_FEATURE_UNAVAILABLE_ON_PLATFORM]: The feature watch recursively is unavailable on the current platform, which is being used to run Node.js
[Info  - 12:12:24 PM] Searching for source files
[Info  - 12:12:24 PM] Found 7 source files

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
fannheywardcommented, Dec 22, 2021

Set "python.analysis.diagnosticMode": "workspace" in your coc-settings.json, tested with https://github.com/last-partizan/coc-project-dir-issue, works as expected.

0reactions
rickyelopezcommented, Aug 18, 2022

Bump on this, I have a similar problem. I’m working out of a monorepo, and I would like to have a pyproject.toml file for a python project that is deep in the repo. I would really like for pyright to be able to find the pyproject file that is in that folder and use that, rather than having to make a pyproject file at the root of the monorepo.

I have

    "workspace.workspaceFolderCheckCwd": false,
    "workspace.bottomUpFiletypes": [
        "python"
    ],

but pyright is still not able to find the pyproject file that is in the project dir.

Read more comments on GitHub >

github_iconTop Results From Across the Web

can't seem to resolve reportMissingImports with coc-pyright on ...
I just upgraded my coc-pyright, and thus I guess pyright too. It does not seem to find my pyrightconfig.json anymore (meaning I get...
Read more >
coc-pyright ignores pyrightconfig.json : r/neovim - Reddit
I have been struggling with coc-pyright lately. It always uses the wrong virtual environment, then blasts me with import errors like crazy.
Read more >
coc-pyright - npm
Configuration Description Default pyright.enable Enable coc‑pyright extension true python.analysis.autoSearchPaths Automatically add common search paths like 'src' true python.analysis.typeshedPaths Paths to look for typeshed modules
Read more >
Pyright import from parent sibling results in missing import
Found a link which pointed out my issue. pyrightconfig.json had to be at the repo root, not the project root. Just solved my...
Read more >
neoclide/coc.nvim - Gitter
Been reading through issues as I can't get it to recognize imports in the venv. @jord_gee_twitter Try to put pyrightconfig.json in the project...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found