Skip to content
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

VSCode WokWi Diagram Editor documentation unclear, leading to custom chips labeled as "Missing" and with no connections shown #947

Open
pekkanikander opened this issue Jan 14, 2025 · 2 comments
Labels
bug Something isn't working

Comments

@pekkanikander
Copy link

pekkanikander commented Jan 14, 2025

Describe the bug

When running the WokWi Diagram Editor as the editor in an editor tab in VSCode, for diagram.json, if there is a custom chip in the project, e.g. custom.chip.json and custom.chip.c files, and the diagram.json is referring to this in parts as "type": "chip-custom", the WokWi Diagram Editor shows a confusing error message Missing chip chip-custom in the part image in the editor and drops the connections with the custom chip.

To Reproduce

  1. Install VSCode and WokWi Simulator extension to VSCode (if you don't have them already)
  2. Clone any suitable WokWi GIT repository, with a custom chip, to VSCode, e.g. https://github.com/wokwi/inverter-chip which is used by the documentation
  3. Open diagram.json for editing
  4. See the WokWi Diagram Editor to appear.

Expected behavior

The custom chip in the project (Inverter) should appear as the defined custom chip, with connections to the other chips.

Current behavior

The custom chip in the project (Inverter) appears as a Missing chip, with no connections to other chips.

Work around

There must be a dist folder, with chip.json and chip.wasm. At this point, VSCode does not produce them automatically but one must build the dist folder and its contents manually.

Environment

macOS 15.2 (24C101)
Safari 18.2 (20620.1.16.11.8)
VSCodium 1.96.2 Release: 24355,
WokWi Simulator extension 2.6.0 - 2024-12-10.

This bug appears to be there also with the WokWi Pro license activated.

Additional context

At https://wokwi.com/_next/static/chunks/4729-9dd899e2e960fade.js in function getChip(t), the chips are only looked at https://wokwi.com/api/external/chips. This does not make sense here, since the chip definition is on the local disk of the VScode host. For custom chips defined in the project, the WokWi extension should first upload the local file to somewhere in the wokwi.com domain so that the WokWi Editor, running in the iframe, could download and read it. The WokWi Editor cannot try to read the file directly from the local disk, as the iframe cannot escape its sandbox. Or, if the WokWi Simulator extension already does upload the file for including it in https://wokwi.com/api/external/chips, there appears to be a bug somewhere else.

As a workaround, one could add a possibility to define a custom URL path for custom chips, allowing the WokWi Editor in the iframe to load the code from a custom URL (if allowed by sandboxing, I don't remember...).

( I hate debugging closed source obfuscated JS code. Hence, there may be errors in my analysis. I didn't want to spend too much time in debugging this. )

@pekkanikander pekkanikander added the bug Something isn't working label Jan 14, 2025
@pekkanikander pekkanikander changed the title VSCode WokWi Diagram Editor does not understand custom chips, dropping connections to them and labelling them as "Missing" VSCode WokWi Diagram Editor documentation unclear, leading to custom chips labeled as "Missing" and with no connection Jan 17, 2025
@pekkanikander pekkanikander changed the title VSCode WokWi Diagram Editor documentation unclear, leading to custom chips labeled as "Missing" and with no connection VSCode WokWi Diagram Editor documentation unclear, leading to custom chips labeled as "Missing" and with no connections shown Jan 17, 2025
@mmxavier
Copy link

I`m facing the same problem with no evolution in solutions.

@hhhouran
Copy link

hhhouran commented Feb 4, 2025

Also facing this issue as of now. This is the only issue found as of now. Any updates?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants