Skip to content

Commit

Permalink
Update extension to the latest version of the playground
Browse files Browse the repository at this point in the history
This is a very big update. It includes various changes:

  * The playground version was updated to include all the latest
    improvements.
  * Because of a refactor, no web workers were needed anymore inside
    VSCode. Instead, the web workers are running directly in the web
    view instead.
  * The development/release configuration was changed significantly to
    make things easier.
  • Loading branch information
aykevl committed Mar 22, 2024
1 parent ac9666d commit b33b1ba
Show file tree
Hide file tree
Showing 10 changed files with 3,114 additions and 4,377 deletions.
36 changes: 13 additions & 23 deletions .vscodeignore
Original file line number Diff line number Diff line change
@@ -1,23 +1,13 @@
.vscode/**
.vscode-test/**
out/
src/**
images/screenshot.png
.gitignore
.yarnrc
vsc-extension-quickstart.md
**/tsconfig.json
**/.eslintrc.json
**/*.map
**/*.ts
webpack.config.js
preview/playground/resources
preview/playground/.*
preview/playground/*.tar.gz
preview/playground/*.go
preview/playground/dashboard.*
preview/playground/Dockerfile
preview/playground/go.*
preview/playground/Makefile
preview/playground/index.html
preview/playground/project.js
# Ignore everything
**

# Include specific files
!LICENSE
!out/*.js
!images/tinygo-logo.png
!preview/webview.*
!preview/playground/LICENSE
!preview/playground/simulator.*
!preview/playground/parts/
!preview/playground/resources/
!preview/playground/worker/webworker.bundle.js
7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.PHONY: webworker.bundle.js
webworker.bundle.js: preview/playground/worker/webworker.bundle.js

# Create webworker.bundle.js by combining these files.
# There's probably a better way to do this using webpack but this works.
preview/playground/worker/webworker.bundle.js: preview/playground/worker/parts.js preview/playground/worker/runner.js preview/playground/worker/wiring.js preview/playground/worker/webworker.js
cat $^ > $@
68 changes: 62 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,72 @@ This extension depends on the following:

## Development

Make sure to checkout `preview/playground` [git submodule](https://git-scm.com/book/en/v2/Git-Tools-Submodules).
Make sure to checkout `preview/playground` [git submodule](https://git-scm.com/book/en/v2/Git-Tools-Submodules). You can do this with the following command:

For easy development, you can modify the package.json file a bit:
git submodule update --init

```diff
- "main": "./dist/extension.js",
+ "main": "./out/extension.js",
For development, you can use the following .vscode/tasks.json file:

```json
{
"version": "2.0.0",
"tasks": [
{
"type": "npm",
"script": "watch",
"problemMatcher": "$tsc-watch",
"isBackground": true,
"presentation": {
"reveal": "never"
},
"group": "build",
"label": "npm: watch",
"detail": "tsc -watch -p ./"
},
{
"type": "npm",
"script": "compile",
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": [],
"label": "npm: compile",
"detail": "tsc -p ./",
"dependsOn": ["webworker.bundle.js"],
},
{
"type": "shell",
"command": "make",
"args": ["preview/playground/worker/webworker.bundle.js"],
"group": "build",
"label": "webworker.bundle.js",
}
]
}
```

There is probably a better way, but this works.
and the following .vscode/launch.json:

```json
{
"version": "0.2.0",
"configurations": [
{
"name": "Run Extension",
"type": "extensionHost",
"request": "launch",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}"
],
"outFiles": [
"${workspaceFolder}/out/**/*.js"
],
"preLaunchTask": "${defaultBuildTask}"
}
]
}
```

To create an extension as a package, run the following command:

Expand Down
Loading

0 comments on commit b33b1ba

Please sign in to comment.