You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We have basic working code completion in Pybricks code but it isn't polished yet. Here are some ideas to make it better. Feel free to add more.
A common mistake for beginner coders is to forget to add () for functions that don't take any parameters. It would be nice if the code completion would automatically insert these for us.
One feature I use quite often in VS Code that would be nice to have is to show help on hover when you hold the mouse over an identifier.
The doc strings don't render well currently. As a hack, we use a conversion from google style to numpy style just to make things look sort of ok, but Parameters and Returns are rendered as large headings, which gets distracting. We could easily make our own renderer that could convert the doc strings to more nicely formatted markdown.
Since we are using jedi for code completion, it is hard-coded to pick up the Python standard library and some 3rd party stubs. We don't want these since we are using our own build of MicroPython which only includes a subset of these. Thonny has some code to make it work better for MicroPython that we might be able to take some inspiration from.
An object-oriented API can make it hard to figure out how to get started, and you can't auto-complete anything without an object. The template for a new file helps a lot, but for example, starting from the hub you are given, it is not at all apparent how to make a motor for that hub. You will need to give up and look at a sample for this. I'd suggest expanding the template UI to ask what devices are connected to what ports, and auto-generate the object creation for these. As an added bonus, you could offer to generate a sample statement for each device (e.g. change hub light color, spin a motor 360 degrees), so the user can see the general obj.function syntax.
It would be nice if the documentation pane automatically scrolled to the relevant section along with an auto-complete menu showing. So, for example, at "hub.speaker." if it would scroll to the "Using the speaker" section of the correct hub. Since a user may want to pin the docs in place sometimes, I suggest making the blue header bar at the top of the doc pane stay and have a button for pin/unpin as well as home (replacing your current hamburger menu), back, forward, etc.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
We have basic working code completion in Pybricks code but it isn't polished yet. Here are some ideas to make it better. Feel free to add more.
()
for functions that don't take any parameters. It would be nice if the code completion would automatically insert these for us.Beta Was this translation helpful? Give feedback.
All reactions