Page 1 of 2

MicroPython with VisualStudio Code

Posted: Wed Apr 03, 2019 2:27 pm
by koldomon
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.

Re: MicroPython with VisualStudio Code

Posted: Wed Apr 03, 2019 2:55 pm
by stijn

Re: MicroPython with VisualStudio Code

Posted: Wed Apr 03, 2019 3:16 pm
by koldomon
....However this question would probably reach the best audience on the MicroPython forum

and here I am :?

Re: MicroPython with VisualStudio Code

Posted: Wed Apr 03, 2019 3:38 pm
by Turbinenreiter
Can we create stubs from the help() output? Or the documentation?

Re: MicroPython with VisualStudio Code

Posted: Wed Apr 03, 2019 3:57 pm
by dhylands
This thread may have some useful links:
viewtopic.php?f=15&t=4846

Re: MicroPython with VisualStudio Code

Posted: Thu Apr 04, 2019 2:45 pm
by koldomon
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.

Re: MicroPython with VisualStudio Code

Posted: Mon Apr 08, 2019 10:31 pm
by josverl
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

Re: MicroPython with VisualStudio Code

Posted: Tue Apr 09, 2019 5:07 pm
by koldomon
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

Re: MicroPython with VisualStudio Code

Posted: Sun Apr 21, 2019 1:55 pm
by josverl
Thanks for the connect,
it would be cool to merge efforts and jointly move forward.

/Jos

Re: MicroPython with VisualStudio Code

Posted: Wed May 29, 2019 5:51 pm
by Benjamin
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?