coc-pyright: Import my own module could not be resolved
Output of :CocCommand pyright.version
:
[coc.nvim] coc-pyright 1.1.161 with Pyright 1.1.161
Output of :CocCommand workspace.showOutput Pyright
:
Workspace: C:\Users\MyPC Using python from C:\Users\MyPC\AppData\Local\Programs\Python\Python39\python.EXE
[Warn - 8:19:35 AM] Ignored rootPath C:\Users\MyPC of client "pyright"
[Info - 8:19:35 AM] Pyright language server 1.1.161 starting
[Info - 8:19:35 AM] Server root directory: C:\Users\MyPC\AppData\Local\coc\extensions\node_modules\coc-pyright\node_modules\pyright/dist/
[Info - 8:19:35 AM] No pyproject.toml file found.
[Info - 8:19:35 AM] Setting pythonPath for service "<default>": "C:\Users\MyPC\AppData\Local\Programs\Python\Python39\python.EXE"
[Warn - 8:19:35 AM] stubPath typings is not a valid directory.
[Info - 8:19:35 AM] Assuming Python version 3.9
[Info - 8:19:35 AM] Assuming Python platform Windows
[Info - 8:19:35 AM] Searching for source files
[Info - 8:19:35 AM] No source files found.
Here is my python folder:
However, when I import my module in the same directory:
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 16 (7 by maintainers)
The language server, here is Pyright, needs the workspace root to work, coc will try to detect the root by some patterns like
.git
,pyproject.toml
andb:coc_root_patterns
, that’s why you need to open vim in your project root.