joedevivo / vscode-circuitpython

VSCode extension for Adafruit's CircuitPython
MIT License
119 stars 34 forks source link

[BUG] modules show as unresolved imports #23

Open mjnorman opened 4 years ago

mjnorman commented 4 years ago

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

askpatrickw commented 4 years ago

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

mjnorman commented 4 years ago

Oops got sidetracked came back and hit submit. Thanks!

julianrendell commented 4 years ago

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.

joedevivo commented 4 years ago

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

julianrendell commented 4 years ago

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.

barbudor commented 4 years ago

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")'

2) changing the stubs file name extensions from .pyi files into .py

adiazulay commented 3 years ago

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 commented 3 years ago

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