Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pylance doesn't suggest the methods in a class #53

Closed
albireox opened this issue Jul 4, 2020 · 5 comments
Closed

Pylance doesn't suggest the methods in a class #53

albireox opened this issue Jul 4, 2020 · 5 comments
Labels
bug Something isn't working fixed in next version (main) A fix has been implemented and will appear in an upcoming version

Comments

@albireox
Copy link

albireox commented Jul 4, 2020

Environment data

  • Language Server version: 2020.6.1
  • OS and version: macOS 10.15.5
  • Python version (& distribution if applicable, e.g. Anaconda): pyenv 3.8.3

Actual behaviour

I'd expect that inside a class, if I type self. Pylance would autosuggest the methods in that class first, along with their docstrings. This is what happens using Jedi. Instead, Pylance seems to think for a long time but ultimately it doesn't suggest anything. If I force the suggestion box or start typing, then I can see the methods but they are not marked as such (the icon is abc) and they are not prioritised so I think those are just the general VSCode suggestions. Once I have written the full name of the method and press ( the docstring is shown correctly.

Logs

[BG]   checking: /uufs/chpc.utah.edu/common/home/u0931042/software/github/target_selection/python/target_selection/xmatch.py (17482ms)
[BG] analyzing: /uufs/chpc.utah.edu/common/home/u0931042/software/github/target_selection/python/target_selection/xmatch.py (18918ms)
[BG] analyzing: /uufs/chpc.utah.edu/common/home/u0931042/software/github/target_selection/python/target_selection/xmatch.py ...
[BG]   checking: /uufs/chpc.utah.edu/common/home/u0931042/software/github/target_selection/python/target_selection/xmatch.py (9270ms)
[BG] analyzing: /uufs/chpc.utah.edu/common/home/u0931042/software/github/target_selection/python/target_selection/xmatch.py (9270ms)
[FG] parsing: /uufs/chpc.utah.edu/common/home/u0931042/.vscode-server-insiders/extensions/ms-python.vscode-pylance-2020.6.1/server/typeshed-fallback/stdlib/2and3/operator.pyi (54ms)
[FG] binding: /uufs/chpc.utah.edu/common/home/u0931042/.vscode-server-insiders/extensions/ms-python.vscode-pylance-2020.6.1/server/typeshed-fallback/stdlib/2and3/operator.pyi (5ms)
[FG] parsing: /uufs/chpc.utah.edu/common/home/u0931042/.vscode-server-insiders/extensions/ms-python.vscode-pylance-2020.6.1/server/typeshed-fallback/stdlib/2and3/copy.pyi (1ms)
[FG] binding: /uufs/chpc.utah.edu/common/home/u0931042/.vscode-server-insiders/extensions/ms-python.vscode-pylance-2020.6.1/server/typeshed-fallback/stdlib/2and3/copy.pyi (1ms)
[FG] parsing: /uufs/chpc.utah.edu/common/home/u0931042/software/github/target_selection/python/target_selection/utils.py (43ms)
[FG] binding: /uufs/chpc.utah.edu/common/home/u0931042/software/github/target_selection/python/target_selection/utils.py (2ms)
[FG] parsing: /uufs/chpc.utah.edu/common/home/u0931042/.vscode-server-insiders/extensions/ms-python.vscode-pylance-2020.6.1/server/typeshed-fallback/stdlib/2and3/uuid.pyi (12ms)
[FG] binding: /uufs/chpc.utah.edu/common/home/u0931042/.vscode-server-insiders/extensions/ms-python.vscode-pylance-2020.6.1/server/typeshed-fallback/stdlib/2and3/uuid.pyi (2ms)
[BG] analyzing: /uufs/chpc.utah.edu/common/home/u0931042/software/github/target_selection/python/target_selection/xmatch.py ...
[BG]   checking: /uufs/chpc.utah.edu/common/home/u0931042/software/github/target_selection/python/target_selection/xmatch.py (9638ms)
[BG] analyzing: /uufs/chpc.utah.edu/common/home/u0931042/software/github/target_selection/python/target_selection/xmatch.py (9638ms)
[FG] parsing: /uufs/chpc.utah.edu/common/home/u0931042/software/github/target_selection/python/target_selection/xmatch.py (167ms)
[FG] binding: /uufs/chpc.utah.edu/common/home/u0931042/software/github/target_selection/python/target_selection/xmatch.py (19ms)
[BG] analyzing: /uufs/chpc.utah.edu/common/home/u0931042/software/github/target_selection/python/target_selection/xmatch.py ...
[BG]   parsing: /uufs/chpc.utah.edu/common/home/u0931042/software/github/target_selection/python/target_selection/xmatch.py (30ms)
[BG]   binding: /uufs/chpc.utah.edu/common/home/u0931042/software/github/target_selection/python/target_selection/xmatch.py (5ms)
[BG]   checking: /uufs/chpc.utah.edu/common/home/u0931042/software/github/target_selection/python/target_selection/xmatch.py (1206ms)
[BG] analyzing: /uufs/chpc.utah.edu/common/home/u0931042/software/github/target_selection/python/target_selection/xmatch.py (1241ms)
[FG] parsing: /uufs/chpc.utah.edu/common/home/u0931042/software/github/target_selection/python/target_selection/xmatch.py (86ms)
[FG] binding: /uufs/chpc.utah.edu/common/home/u0931042/software/github/target_selection/python/target_selection/xmatch.py (7ms)
[BG] analyzing: /uufs/chpc.utah.edu/common/home/u0931042/software/github/target_selection/python/target_selection/xmatch.py ...
[BG]   parsing: /uufs/chpc.utah.edu/common/home/u0931042/software/github/target_selection/python/target_selection/xmatch.py (18ms)
[BG]   binding: /uufs/chpc.utah.edu/common/home/u0931042/software/github/target_selection/python/target_selection/xmatch.py (8ms)
[BG]   checking: /uufs/chpc.utah.edu/common/home/u0931042/software/github/target_selection/python/target_selection/xmatch.py (1298ms)
[BG] analyzing: /uufs/chpc.utah.edu/common/home/u0931042/software/github/target_selection/python/target_selection/xmatch.py (1324ms)
[BG] analyzing: /uufs/chpc.utah.edu/common/home/u0931042/software/github/target_selection/python/target_selection/xmatch.py ...
[BG]   parsing: /uufs/chpc.utah.edu/common/home/u0931042/software/github/target_selection/python/target_selection/xmatch.py (18ms)
[BG]   binding: /uufs/chpc.utah.edu/common/home/u0931042/software/github/target_selection/python/target_selection/xmatch.py (6ms)
[FG] parsing: /uufs/chpc.utah.edu/common/home/u0931042/software/github/target_selection/python/target_selection/xmatch.py (51ms)
[FG] binding: /uufs/chpc.utah.edu/common/home/u0931042/software/github/target_selection/python/target_selection/xmatch.py (10ms)
[BG]   checking: /uufs/chpc.utah.edu/common/home/u0931042/software/github/target_selection/python/target_selection/xmatch.py ...
[BG]     parsing: /uufs/chpc.utah.edu/common/home/u0931042/.vscode-server-insiders/extensions/ms-python.vscode-pylance-2020.6.1/server/typeshed-fallback/stdlib/2and3/_warnings.pyi (12ms)
[BG]     binding: /uufs/chpc.utah.edu/common/home/u0931042/.vscode-server-insiders/extensions/ms-python.vscode-pylance-2020.6.1/server/typeshed-fallback/stdlib/2and3/_warnings.pyi (1ms)
[BG]     parsing: /uufs/chpc.utah.edu/common/home/u0931042/.vscode-server-insiders/extensions/ms-python.vscode-pylance-2020.6.1/server/typeshed-fallback/stdlib/3/configparser.pyi (17ms)
[BG]     binding: /uufs/chpc.utah.edu/common/home/u0931042/.vscode-server-insiders/extensions/ms-python.vscode-pylance-2020.6.1/server/typeshed-fallback/stdlib/3/configparser.pyi (3ms)
@erictraut
Copy link
Contributor

Thanks for reporting the problem. You are correct, of course. It should suggest methods, properties and instance variables that are appropriate for self.

This is a regression that was introduced recently when we changed the way the type of self is inferred. I've addressed the problem, and the fix will be in an upcoming version of Pylance.

@albireox
Copy link
Author

albireox commented Jul 4, 2020

Thanks for the super quick answer and fix!

@erictraut erictraut added bug Something isn't working fixed in next version (main) A fix has been implemented and will appear in an upcoming version labels Jul 4, 2020
@Ashesh3
Copy link
Member

Ashesh3 commented Jul 6, 2020

Having the same issue. Thanks for the fix! Hoping to be released soon.

image

@luliangce
Copy link

Environment data

  • Pylance language server 2020.6.1
  • macOs 10.15.5
  • python 3.7.4 64-bit with poetry
appnope==0.1.0
asgiref==3.2.7
astroid==2.4.2
backcall==0.2.0
certifi==2020.4.5.2
chardet==3.0.4
coverage==5.1
decorator==4.4.2
Django==3.0.7
django-cors-headers==3.3.0
django-redis==4.12.1
ecdsa==0.15
gunicorn==20.0.4
idna==2.9
imbox==0.9.6
ipython==7.15.0
ipython-genutils==0.2.0
isort==4.3.21
jedi==0.17.0
lazy-object-proxy==1.4.3
mccabe==0.6.1
mysqlclient==1.4.6
parso==0.7.0
pexpect==4.8.0
pickleshare==0.7.5
prompt-toolkit==3.0.3
ptyprocess==0.6.0
pyasn1==0.4.8
Pygments==2.6.1
pylint==2.5.3
python-jose==3.1.0
pytz==2020.1
PyYAML==5.3.1
redis==3.5.3
requests==2.23.0
rope==0.17.0
rsa==4.1
six==1.15.0
sqlparse==0.3.1
toml==0.10.1
traitlets==4.3.3
typed-ast==1.4.1
urllib3==1.25.9
wcwidth==0.2.4
wrapt==1.12.1
yapf==0.29.0

my minimal reproduce:

first , start new django project and app, then edit {appName}/tests.py

from django.test import TestCase

class DemoTest(TestCase):
    def test_demo(self):
        self.assertEqual(1, 1)  # <-- issue here

截屏2020-07-07 下午1 20 18

@jakebailey
Copy link
Member

This issue has been fixed in version 2020.7.0, which we've just released. You can find the changelog here: https://github.com/microsoft/pylance-release/blob/master/CHANGELOG.md#202070-9-july-2020

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fixed in next version (main) A fix has been implemented and will appear in an upcoming version
Projects
None yet
Development

No branches or pull requests

5 participants