MicroPython with VisualStudio Code

Discussion about programs, libraries and tools that work with MicroPython. Mostly these are provided by a third party.
Target audience: All users and developers of MicroPython.
koldomon
Posts: 4
Joined: Wed Apr 03, 2019 2:01 pm

MicroPython with VisualStudio Code

Post by koldomon » Wed Apr 03, 2019 2:27 pm

I want to develop with Visual Studio Code and I'm struggeling with the Code-Completion. I searched nearly a week for a solution to get this working, but Modules like "machine" or "network" won't be recognized. Obviously I'm to stupid, so please could anybody write a little "step-by-step guide" or a simple "how-to".

I already get the Board specific modules (for ESP8266 in my case) by simply adding the sources of micropython (a git clone) to "python.autoComplete.extraPaths" in my settings.json, but this doesn't work for the previously named modules.

I'm using the "Micropython IDE" and "Pymakr" Extensions in VSCode wich are working fine.

stijn
Posts: 348
Joined: Thu Apr 24, 2014 9:13 am

Re: MicroPython with VisualStudio Code

Post by stijn » Wed Apr 03, 2019 2:55 pm


koldomon
Posts: 4
Joined: Wed Apr 03, 2019 2:01 pm

Re: MicroPython with VisualStudio Code

Post by koldomon » Wed Apr 03, 2019 3:16 pm

....However this question would probably reach the best audience on the MicroPython forum

and here I am :?

Turbinenreiter
Posts: 288
Joined: Sun May 04, 2014 8:54 am

Re: MicroPython with VisualStudio Code

Post by Turbinenreiter » Wed Apr 03, 2019 3:38 pm

Can we create stubs from the help() output? Or the documentation?

User avatar
dhylands
Posts: 3212
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: MicroPython with VisualStudio Code

Post by dhylands » Wed Apr 03, 2019 3:57 pm

This thread may have some useful links:
viewtopic.php?f=15&t=4846

koldomon
Posts: 4
Joined: Wed Apr 03, 2019 2:01 pm

Re: MicroPython with VisualStudio Code

Post by koldomon » Thu Apr 04, 2019 2:45 pm

Sorry, I forget to tell you, that I'm absolutly new to Python programming

I kindly ask for someone to post a simple "Do this, then do that" instruction manual to get Intellisense working for micropython.

User avatar
josverl
Posts: 8
Joined: Fri Nov 24, 2017 4:22 pm

Re: MicroPython with VisualStudio Code

Post by josverl » Mon Apr 08, 2019 10:31 pm

Hi , Ive been working on a solution to help with both code completion and linting for VSCode.
It's still quite experimental, and requires some manual configuration but I am gently optimistic.

https://github.com/Josverl/micropython-stubber

The way it currently works is to
- generate the subs on the Micropython board ( to cater for different firmwares)
- download the stubs to a folder on your harddrive
- configure autoclomplete and pylint to use these stubs.

the downside is that the stubs generated this way have no parameter or type information
I just discovered the micropython-cpython-* modules on pypi , and as they do have that information that may be helpful,
but there is additional work to match up / merge and download these so they can be used in a similar way

Jos

koldomon
Posts: 4
Joined: Wed Apr 03, 2019 2:01 pm

Re: MicroPython with VisualStudio Code

Post by koldomon » Tue Apr 09, 2019 5:07 pm

Hi josverl,
I'm glad to hear from your work. By the time I ask the VSCode-Python Team to support micropython as well and the are evaluating the request https://github.com/Microsoft/vscode-python/issues/5098

If it's ok for you, then I will also link your repository in the Request, maybe if you and the MS-Team work together we all could get an outstanding solution. In my opinion is the support in VSCode a "must have" these days.

greetings

User avatar
josverl
Posts: 8
Joined: Fri Nov 24, 2017 4:22 pm

Re: MicroPython with VisualStudio Code

Post by josverl » Sun Apr 21, 2019 1:55 pm

Thanks for the connect,
it would be cool to merge efforts and jointly move forward.

/Jos

Benjamin
Posts: 1
Joined: Wed May 29, 2019 5:45 pm

Re: MicroPython with VisualStudio Code

Post by Benjamin » Wed May 29, 2019 5:51 pm

Hello from San Luis Argentina. Nice Work. I run the script for the stubbs on a Lopy 1.0 with pycom Firmware and it works fine. The use in VisualStudio i have not tested yet. I prefer to use Atom is there a possibility to use the stubs with the Jedi Plugin in Atom?

Post Reply