Skip to content

Commit

Permalink
Merge complete new Wokwi-Intellij to main
Browse files Browse the repository at this point in the history
Complete rebuild of Wokwi-Intellij with the goal of version 1.0
  • Loading branch information
Jozott00 authored Feb 23, 2024
2 parents f4c69fe + c7c24b9 commit 943c4d4
Show file tree
Hide file tree
Showing 130 changed files with 3,983 additions and 867 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:

# Setup Gradle
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
uses: gradle/gradle-build-action@v3
with:
gradle-home-cache-cleanup: true

Expand Down Expand Up @@ -113,7 +113,7 @@ jobs:

# Setup Gradle
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
uses: gradle/gradle-build-action@v3
with:
gradle-home-cache-cleanup: true

Expand All @@ -131,7 +131,7 @@ jobs:

# Upload the Kover report to CodeCov
- name: Upload Code Coverage Report
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
with:
files: ${{ github.workspace }}/build/reports/kover/report.xml

Expand Down Expand Up @@ -166,7 +166,7 @@ jobs:

# Run Qodana inspections
- name: Qodana - Code Inspection
uses: JetBrains/[email protected].0
uses: JetBrains/[email protected].1
with:
cache-default-branch-only: true

Expand Down Expand Up @@ -197,13 +197,13 @@ jobs:

# Setup Gradle
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
uses: gradle/gradle-build-action@v3
with:
gradle-home-cache-cleanup: true

# Cache Plugin Verifier IDEs
- name: Setup Plugin Verifier IDEs Cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ needs.build.outputs.pluginVerifierHomeDir }}/ides
key: plugin-verifier-${{ hashFiles('build/listProductsReleases.txt') }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:

# Setup Gradle
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
uses: gradle/gradle-build-action@v3
with:
gradle-home-cache-cleanup: true

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/run-ui-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:

# Setup Gradle
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
uses: gradle/gradle-build-action@v3
with:
gradle-home-cache-cleanup: true

Expand All @@ -54,7 +54,7 @@ jobs:

# Wait for IDEA to be started
- name: Health Check
uses: jtalk/url-health-check-action@v3
uses: jtalk/url-health-check-action@v4
with:
url: http://127.0.0.1:8082
max-attempts: 15
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@
.idea
.qodana
build

.notes
.run
1 change: 1 addition & 0 deletions .run/Run Plugin.run.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
<DebugAllEnabled>false</DebugAllEnabled>
<RunAsTest>false</RunAsTest>
<method v="2" />
</configuration>
</component>
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,7 @@

## [Unreleased]
### Added
- Initial scaffold created from [IntelliJ Platform Plugin Template](https://github.com/JetBrains/intellij-platform-plugin-template)
- Embedded Wokwi simulator
- Wokwi console to control simulator
- wokwi.toml analysis support
- Wokwi simulation debugging support
121 changes: 110 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,119 @@
# IntelliJ Wokwi Simulator Plugin

This plugin integrates the [Wokwi](https://wokwi.com/) simulator for ESP32 devices into JetBrains' IntelliJ-based IDEs.
The project is currently in its early stages and has not yet been published on JetBrains' Marketplace.
<a name="readme-top"></a>

## Project Status
<!-- PROJECT SHIELDS -->
[![Contributors][contributors-shield]][contributors-url]
[![MIT License][license-shield]][license-url]
[![Issues][issues-shield]][issues-url]
[![Forks][forks-shield]][forks-url]
[![Stargazers][stars-shield]][stars-url]

The version in the `main` branch is very unstable and uses a non-maintaned version of the Wokwi simulator. Therefore, the plugin is rewritten and uses the same Wokwi simulator as the official VS-Code extension. In addition, the plugin configuration is aligned with the VS-Code configuration, i.e. the file `wokwi.toml` defines all relevant settings. This makes switching between IDEs effortless.
<!-- PROJECT LOGO -->
<br />
<div align="center">
<a href="https://github.com/Jozott00/wokwi-intellij">
<!--
<picture>
<source media="(prefers-color-scheme: dark)" srcset="./blob/imgs/pluginIcon_dark.svg" width="80" height="80">
<img alt="Wokwi Intellij Icon" src="./blob/imgs/logoColorful.svg" width="80" height="80">
</picture>
-->
<img alt="Wokwi Intellij Icon" src="./blob/imgs/logoColorful.svg" width="120" height="120">
</a>


The progress of the new plugin version is tracked in the pull request [#14](https://github.com/Jozott00/wokwi-intellij/pull/14).
<h3 align="center">Wokwi Intellij Plugin</h3>

<p align="center">
Integrate Wokwi in Intellij-based Jetbrains IDEs.
<br />
<a href="https://jozott00.github.io/wokwi-intellij/starter-topic.html"><strong>Explore the docs »</strong></a>
<br />
<br />
<a href="https://github.com/Jozott00/wokwi-intellij/issues">Report Bug</a>
·
<a href="https://github.com/Jozott00/wokwi-intellij/issues">Request Feature</a>
</p>
</div>

<!-- ABOUT THE PROJECT -->
## About The Plugin

## Main branch version
![Wokwi Debug Showcase](blob/imgs/sim_running.png)

At present, it is possible to specify and run a binary on the Wokwi simulator within the IDE. By enabling binary watch,
the simulation automatically restarts after each new binary build.
<!-- Plugin description -->
The Wokwi Intellij plugin, an open-source tool, integrates the [Wokwi](https://wokwi.com) simulator with Jetbrains IDEs like CLion and RustRover.
It adopts the Wokwi VS Code extension's configuration approach for seamless IDE transitions, supporting the same platforms.

This plugin is a community plugin and not maintained by the [Wokwi](https://wokwi.com) team.
<!-- Plugin description end -->

### Features
- Run simulation in IDE window
- Automatically restart the simulation on rebuild
- Intelligent configuration checking
- Intellij idiomatic debugging (CLion only)

<!-- GETTING STARTED -->
## Documentation

Please visit the [Wokwi Intellij documentation](https://jozott00.github.io/wokwi-intellij/starter-topic.html).

### Installation

To follow the installation instructions, users typically navigate to the [installation section](https://jozott00.github.io/wokwi-intellij/starter-topic.html#installation).

For building and installing the plugin from source:
1. Clone or download the repository.
2. Execute `./gradlew buildPlugin`. <br/> This action saves the plugin build as `build/distributions/wokwi-intellij-x.x.x.zip`.
3. Follow steps to [install the plugin from disk](https://www.jetbrains.com/help/idea/managing-plugins.html#install_plugin_from_disk).



<!-- ROADMAP -->
## Roadmap

- [ ] Make Console writable
- [ ] Add Serial Port forwarding
- [ ] Add IoT gateway
- [ ] Support custom chips
- [ ] Add diagram.json editor

See the [open issues](https://github.com/Jozott00/wokwi-intellij/issues) for a full list of proposed features (and known issues).


<!-- CONTRIBUTING -->
## Contributing

To make this plugin even better, contributions are very welcome!

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag `enhancement`.
1. Fork the Project
2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)
3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)
4. Push to the Branch (`git push origin feature/AmazingFeature`)
5. Open a Pull Request



<!-- LICENSE -->
## License

Distributed under the MIT License. See `LICENSE.txt` for more information.




<!-- MARKDOWN LINKS & IMAGES -->
<!-- https://www.markdownguide.org/basic-syntax/#reference-style-links -->
[contributors-shield]: https://img.shields.io/github/contributors/jozott00/wokwi-intellij.svg
[contributors-url]: https://github.com/Jozott00/wokwi-intellij/graphs/contributors
[forks-shield]: https://img.shields.io/github/forks/jozott00/wokwi-intellij.svg
[forks-url]: https://github.com/Jozott00/wokwi-intellij/network/members
[stars-shield]: https://img.shields.io/github/stars/jozott00/wokwi-intellij.svg
[stars-url]: https://github.com/Jozott00/wokwi-intellij/stargazers
[issues-shield]: https://img.shields.io/github/issues/jozott00/wokwi-intellij.svg
[issues-url]: https://github.com/Jozott00/wokwi-intellij/issues
[license-shield]: https://img.shields.io/github/license/Jozott00/wokwi-intellij.svg
[license-url]: https://github.com/Jozott00/wokwi-intellij/blob/master/LICENSE.txt

![Simulation Configuration](https://github.com/Jozott00/wokwi-intellij/blob/main/blob/imgs/sim_screenshot0.png)
![Running Simulation](https://github.com/Jozott00/wokwi-intellij/blob/main/blob/imgs/sim_screenshot1.png)
16 changes: 16 additions & 0 deletions blob/imgs/logoColorful.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
45 changes: 45 additions & 0 deletions blob/imgs/pluginIcon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions blob/imgs/pluginIcon_dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added blob/imgs/sim_cfg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added blob/imgs/sim_dbg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added blob/imgs/sim_running.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 6 additions & 3 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@ repositories {
dependencies {
implementation(files("libs/espimg-0.1.0.jar"))
implementation("org.java-websocket:Java-WebSocket:1.5.4")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.0")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.2")
implementation("com.beust:klaxon:5.6")
implementation("com.akuleshov7:ktoml-core:0.5.1")
implementation("com.akuleshov7:ktoml-file:0.5.1")
implementation("io.arrow-kt:arrow-core:1.2.1")
}

// Set the JVM language level used to build the project. Use Java 11 for 2020.3+, and Java 17 for 2022.2+.
Expand Down Expand Up @@ -148,7 +152,6 @@ tasks {
// The pluginVersion is based on the SemVer (https://semver.org) and supports pre-release labels, like 2.1.7-alpha.3
// Specify pre-release label to publish the plugin in a custom Release Channel automatically. Read more:
// https://plugins.jetbrains.com/docs/intellij/deployment.html#specifying-a-release-channel
channels =
properties("pluginVersion").map { listOf(it.split('-').getOrElse(1) { "default" }.split('.').first()) }
channels = properties("pluginVersion").map { listOf(it.split('-').getOrElse(1) { "default" }.split('.').first()) }
}
}
6 changes: 6 additions & 0 deletions docs/devnotes/c.list
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE categories
SYSTEM "https://resources.jetbrains.com/writerside/1.0/categories.dtd">
<categories>
<category id="wrs" name="Writerside documentation" order="1"/>
</categories>
13 changes: 13 additions & 0 deletions docs/devnotes/redirection-rules.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE rules SYSTEM "https://resources.jetbrains.com/writerside/1.0/redirection-rules.dtd">
<rules>
<!-- format is as follows
<rule id="<unique id>">
<accepts>page.html</accepts>
</rule>
-->
<rule id="8f79c39">
<description>Created after removal of "Debug Architecture" from wokwi-intellij-notes</description>
<accepts>Debug-Architecture.html</accepts>
</rule>
</rules>
24 changes: 24 additions & 0 deletions docs/devnotes/topics/Communication-Architecture.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Communication Architecture

The plugin uses a wrapper around the simulator webview (iframe), to establish communication with the plugin.
It essentially serves as communcation proxy between the plugin and webview, as the communication
requirements for both sides are different.

> **Wcode** is the VSCode version of the Wokwi Simulator
```mermaid
sequenceDiagram
Intellij Plugin -->> Wcode Wrapper: Injects MessageRouter to listen on window.jcef()
Wcode -->> Wcode Wrapper: Sends message using postMessage(..., port)
Wcode Wrapper --> Wcode: Communicates over exchanged port
Intellij Plugin --> Wcode Wrapper: Communicates over injected message router
Intellij Plugin --> Wcode: Communicates using Wcode Wrapper in between
```

## Wcode

The url of the Wcode simulator is `https://wokwi.com/vscode/wcode?v=<version>`

E.g. `https://wokwi.com/vscode/wcode?v=2.4.0&g=10277ff&u=385442252248670209`
11 changes: 11 additions & 0 deletions docs/devnotes/topics/Debugger.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Debugger

> This is not yet a good note
{style="warning"}

<procedure title="Implementing the debugger" id="implementing_the_debugger">
<step>Research on other debuggers</step>
<step>Create custom runner</step>
</procedure>

See [Custom Intellij Debugger](Intellij-Debugger.md) for research results.
17 changes: 17 additions & 0 deletions docs/devnotes/topics/Intellij-Debugger.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Intellij Debugger

Research results regarding the Intellij platform debuggers.

**Intellij Community Classes**
- [XDebugProcess Abstract Class](https://github.com/JetBrains/intellij-community/blob/master/platform/xdebugger-api/src/com/intellij/xdebugger/XDebugProcess.java#L37)
provides debugging capabilities for a custom language/framework


## Python Intellij Debugger
[Source Directory](https://github.com/JetBrains/intellij-community/tree/master/python/src/com/jetbrains/python/debugger)

The [PyRemoteDebugProcess](https://github.com/JetBrains/intellij-community/blob/master/python/src/com/jetbrains/python/debugger/PyRemoteDebugProcess.java)
and its [PyDebugProcess](https://github.com/JetBrains/intellij-community/blob/master/python/src/com/jetbrains/python/debugger/PyDebugProcess.java) might be
a good starting point to implement a debug process to attach to Wokwi's GDB stub.

For the Runner take a look at the [Execution Documentation](https://plugins.jetbrains.com/docs/intellij/execution.html)
Loading

0 comments on commit 943c4d4

Please sign in to comment.