pylint-dev / pylint

It's not just a linter that annoys you!
https://pylint.readthedocs.io/en/latest/
GNU General Public License v2.0
5.19k stars 1.1k forks source link

autocomplete and pylint not working on code, but works on debug console #2708

Closed mwindowshz closed 5 years ago

mwindowshz commented 5 years ago

I am new to vscode, using for python. (tried fining answer but ...)

Autocoplete and pylint not working when editing code, but autocoplete works fine while debugging and writing in debug console.

Current behavior

autocomplete on file: does not recognise torch.rand() image

Expected behavior

but in debug console it shows the correct autocomplete image

problem with pylint : shoes many errors on basic typs such as torch.ones image

I am using pythorch ver 1.0.0 VS Code version: Code 1.30.2 (61122f8, 2019-01-07T22:54:13.295Z) OS version: Windows_NT x64 10.0.17134 System Info Extensions (4)

Steps to reproduce

  1. just write code with pytorch
  2. I import torch
  3. call torch.ones and get the error - 'no member called ones'

pylint --version output

pylint 2.2.2 astroid 2.1.0 Python 3.6.4 |Anaconda, Inc.| (default, Jan 16 2018, 10:22:32) [MSC v.1900 64 bit (AMD64)]

PCManticore commented 5 years ago

Hey @mwindowshz Thanks for reporting an issue. Unfortunately the autocomplete feature that you are using in VSCode is not coming from pylint, I don't know exactly what it uses, but it's either using jedi library or VSCode has its own autocompleter. Regarding the other errors you are seeing, this time from pylint, it could help if you can try to add the following settings in your VSCode pylint configuration: --extension-pkg-whitelist=pytorch. Unfortunately I don't use VSCode myself so I don't exactly how or where that flag looks like for VSCode itself. But if you have a pylintrc configuration file and if you run pylint from command line, adding that flag in the config file should make sure that pytorch members can be found, if they are coming from a C extension, which I assume pytorch actually is.

Let me know if this helps.

mwindowshz commented 5 years ago

Hi If you can explain the whitelist meaning. when writing --extension-pkg-whitelist=pytorch pylint would not check any errors for pytorch?

I would try this. (searching for the configuration placment of pylintrc file - on windows) Thanks