- Notifications
You must be signed in to change notification settings - Fork 3
Initial "TinyGo Preview" implementation #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| Note: So step 4 is the following if u have not installed vsce
|
| When having a workspace with multiple projects, the extension is unable to locate the correct project and choses a "random" one.
I have used https://github.com/Nerzal/tinygo-playground for the test. The result preview always looked like the following screenshot I also get this exact preview, when i open other projects, which only contain a single main file |
Yes, this should indeed be improved. I think it's best to initially run |
Reloading is not necessary anymore since https://go-review.googlesource.com/c/vscode-go/+/254370/ got merged.
This makes it possible to preview things in a folder with multiple projects (and thus multiple main files).
I have implemented this. It uses the directory of the open Go file as the package directory to build. This makes it possible to work in a workspace with multiple projects. |
This makes it a lot easier to know which pad to use to connect a wire.
This more accurately simulates the real hardware.
Objects that had something to the left of the outline would jump a little bit on the first movement, because of incorrect offset calculation of the click position.
This has the big advantage that it becomes possible for mouse events to affect the device itself instead of just the outline (which is a rectangle).
This commit also adds the ability for boards to define their own pad areas, as is very important with the BBC micro:bit with its edge connector.
This is necessary especially for the BBC micro:bit, as it is nearly black and would otherwise be hard to distinguish from the black background. There is also the drop-shadow CSS property but unfortunately it doesn't work yet in Chrome / VS Code. It works in Firefox however. See this Chrome bug: https://bugs.chromium.org/p/chromium/issues/detail?id=109224
This is necessary as Go modules may otherwise complain that it's trying to build a package outside of the module it's currently in. Therefore, set the CWD to the package to build and just build the current directory.
I keep confusing anode/cathode terminology...
This required some fiddling with rotation and board-internal connections to appear right. Right now the LEDs are barely visible. This should be fixed in the future, but for now, examples/microbit-blink (in TinyGo) works.
| Improved the preview feature a lot, most importantly by adding BBC micro:bit support. I can now open the TinyGo project in VS Code, select the microbit in the TinyGo extension, navigate to src/examples/microbit-blink, and click "preview" to see a blinking LED on the BBC micro:bit (although it's not very visible, I hope to improve that in the future). |
This simplifies the LED and will be useful in the future.
This is a type of display often used in 240x240 IPS displays, for example in the PineTime. It works with the st7789 driver in the TinyGo drivers repository.
| why is it not merged? |
| I've essentially rewritten all of it with a better design. I'll push it soon! |
| I've finally pushed the branch, which is at #5. |

I have been working on a "preview" feature for the TinyGo extension. It does something similar to play.tinygo.org, but with much more flexibility, a nicer UI, and integrated directly in VS Code.
Eventually this should also end up on play.tinygo.org, but for now I'm focusing on the extension.
You can test it this way:
previewbranch.vsce package(see here).arduinoorarduino-nano33).