fannheyward / coc-pyright

Pyright extension for coc.nvim
MIT License
1.29k stars 47 forks source link

Doesn't work over some Django modules #799

Closed dmchmk closed 2 years ago

dmchmk commented 2 years ago

Hi!

I've installed coc and coc-pyright and for some reason it sometimes works and sometimes doesn't.

For example, here's a local function and everything's perfect:

https://imgur.com/a/aYdpJi0 https://imgur.com/a/HIziTcU

Pyright even suggests names of function argument.

But when I try to work with Django's internals, like request object, nothing happens at all: https://imgur.com/a/epGt1Tg

Or another case, with user-defined models, also nothing at all: https://imgur.com/a/jriqCzn https://imgur.com/a/7Y5Eu2g

What am I missing?

OS: MacOS 12.5, M1 Vim: 9.0.65 Python: 3.8.9 inside Pipenv shell

What's the output of :CocCommand pyright.version [coc.nvim] coc-pyright 1.1.268 with Pyright 1.1.268

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

Workspace: /Users/mega_venik/Dev/xtips
Using python from /Users/mega_venik/.local/share/virtualenvs/xtips-F9F2eyET/bin/python

[Info  - 02:06:23] Pyright language server 1.1.268 starting
[Info  - 02:06:23] Server root directory: /Users/mega_venik/.config/coc/extensions/node_modules/coc-pyright/node_modules/pyright/dist/
[Info  - 02:06:23] Starting service instance "xtips"
[Info  - 02:06:23] No configuration file found.
[Info  - 02:06:23] No pyproject.toml file found.
[Info  - 02:06:23] Setting pythonPath for service "xtips": "/Users/mega_venik/.local/share/virtualenvs/xtips-F9F2eyET/bin/python"
[Warn  - 02:06:23] stubPath /Users/mega_venik/Dev/xtips/typings is not a valid directory.
[Info  - 02:06:23] Assuming Python version 3.8
[Info  - 02:06:23] Assuming Python platform Darwin
[Info  - 02:06:23] Searching for source files
[Info  - 02:06:23] Found 23 source files
[Info  - 02:07:39] No configuration file found.
[Info  - 02:07:39] No pyproject.toml file found.
[Info  - 02:07:39] Setting pythonPath for service "cloned service": "/Users/mega_venik/.local/share/virtualenvs/xtips-F9F2eyET/bin/python"
[Warn  - 02:07:39] stubPath /Users/mega_venik/Dev/xtips/typings is not a valid directory.
[Info  - 02:07:39] Assuming Python version 3.8
[Info  - 02:07:39] Assuming Python platform Darwin
[Error - 02:07:39] Import 'Django' not found
[Error - 02:07:39] Import 'Django' could not be resolved
[Error - 02:07:39] An error occurred when creating type stub for 'Django': Import 'Django' could not be resolved
[Info  - 02:07:46] No configuration file found.
[Info  - 02:07:46] No pyproject.toml file found.
[Info  - 02:07:46] Setting pythonPath for service "cloned service": "/Users/mega_venik/.local/share/virtualenvs/xtips-F9F2eyET/bin/python"
[Warn  - 02:07:46] stubPath /Users/mega_venik/Dev/xtips/typings is not a valid directory.
[Info  - 02:07:46] Assuming Python version 3.8
[Info  - 02:07:46] Assuming Python platform Darwin
fannheyward commented 2 years ago

It's Pyright's issue.