sg-wireless / pymakr-vsc

GNU General Public License v3.0
99 stars 25 forks source link

Intellisense/linting for pycom libraries #48

Open choeffer opened 5 years ago

choeffer commented 5 years ago

Feature Request 🚀

Describe the solution you'd like

https://code.visualstudio.com/docs/editor/intellisense / https://code.visualstudio.com/docs/python/linting also for modules/classes from the MicroPython and Pycom libraries. Without code completion / linting everything has to be looked up in the docs and even simple mistakes are not highlighted by vsc as they normally would be via pylint.

Teachability, Documentation, Adoption, Migration Strategy

Maybe this can be done with a venv where the pycom modules/classes are imported/installed so that they are found by the vsc Python extension. I also found https://github.com/Josverl/micropython-stubber which can be used/extended for this.

Josverl commented 5 years ago

:-) Yes this is indeed something that I have been working on. not sure if it should be a seperate add-in , part of pymakr or part of the python add-in

for now looking for a way to have an add-in automatically configure options for other add-ins ; ie for addin foo-bar to set options for pylint (.pylintrc) and the python add-in (in settings.json)

RalphHogenbirk commented 5 years ago

Would be awesome, had more people asking for this. Let me know if you have any progress on this @Josverl. A separate add-in would be nice. Possibly with Pymakr detecting if it's installed and advising the user to do so? Making it part of Pymakr would also work for me, but separating it would make more sense.

BradenM commented 5 years ago

@RalphHogenbirk @Josverl I've started something at BradenM/micropy-cli that may be useful towards this. It makes use of Josverl's createstubs.py to automate stub creation (from any plugged in pyboard-like device) and manage any other stubs you may use. Then when you add stubs, running micropy init <project> allows you to select the stubs you wish to use and creates a project folder with them setup via .vscode and .pylintrc as described in micropython-stubber. It's very early on as of right now, but wanted to see what you guys think before I continue it's development.

Josverl commented 5 years ago

Hi Braden, That looks cool. I added Frozen modules to improve Intellisense, and there i found that its even more important to have the exact correct order and Casing in the config files. so any help our whetware can get will only improve matters.

@Ralph a seperate add-in would make sense, but I wonder if it is possible to call some pymakr functions from my add-in ? ie to ask pymakr to run a .py file on the MCU , and to download generated the stubs to a folder ?

But I think I'll start with the configuration and download of the stubs parts first ;-)

BradenM commented 5 years ago

@Josverl, Nice, I will definitely take a look at the frozen modules. Thanks.

Also, perhaps I was a bit unclear when I said "automate stub creation" earlier. Except for the calling Pymakr part, micropy stubs create <port> actually does exactly what you just said. (as can be seen here). Its currently a bit rough and needs some work, but running the command does the following:

Is this close to what you had in mind?

askpatrickw commented 4 years ago

Until this gets sorted out... I made the GPY version https://github.com/askpatrickw/pycom-stubs/

Josverl commented 1 year ago

https://github.com/Josverl/micropython-stubs#micropython-stubs