vscode-circuitpython icon indicating copy to clipboard operation
vscode-circuitpython copied to clipboard

[BUG] modules show as unresolved imports

Open mjnorman opened this issue 5 years ago • 8 comments

Modules built into circuit python show up as unresolved imports. Just using the basic starting script shows errors on board and digitalio.

Everything works however.

image

mjnorman avatar Sep 11 '20 18:09 mjnorman

@mjnorman You might want to update the title of this issue. It just says [BUG]. ;-)

askpatrickw avatar Sep 11 '20 19:09 askpatrickw

Oops got sidetracked came back and hit submit. Thanks!

mjnorman avatar Sep 11 '20 20:09 mjnorman

I had the same issue - discovered that selecting any other linter (shift-command/ctrl-p -> python select linter) than pylint makes everything work. Quickly tried flake8, bandit, and prospector.

Seems that pylint doesn't respect the "python.autoComplete.extraPaths": in the workspace config file.

julianrendell avatar Sep 26 '20 08:09 julianrendell

I'll take a look at having it automatically switch off pylint in the extension initialization.

joedevivo avatar Sep 26 '20 14:09 joedevivo

My 2c would be to leave it on, but make a note in the description. Lint'ing is useful, and seems to be required for the autocomplete to work. And for me, any/all the other linters work great with your plugin.

julianrendell avatar Sep 30 '20 17:09 julianrendell

Hi I've been able to (mostly) use pylint with the following tricks :

  1. Adding a .pylintrc such as :
[MASTER]
init-hook='import sys; sys.path.append("c:/Users/myusername/.vscode/extensions/joedevivo.vscode-circuitpython-0.1.3/boards/0x239A/0x8019");sys.path.append("c:/Users/myusername/.vscode/extensions/joedevivo.vscode-circuitpython-0.1.3/stubs");sys.path.append("c:/Users/myusername/AppData/Roaming/Code/User/globalStorage/joedevivo.vscode-circuitpython/bundle/20201028/adafruit-circuitpython-bundle-py-20201028/lib")'
  1. changing the stubs file name extensions from .pyi files into .py

barbudor avatar Oct 28 '20 23:10 barbudor

Adafruit has a good post for how to setup pylint for circuit python. The extension should probably autogenerate this file if it detects pylint is enabled.

adiazulay avatar Feb 25 '21 00:02 adiazulay

@joedevivo, I can take a stab at adding support for pylint

adiazulay avatar Apr 09 '21 17:04 adiazulay