Skip to content

Commit

Permalink
[dev] fix #6081: how to debug the plugin host
Browse files Browse the repository at this point in the history
Signed-off-by: Anton Kosyakov <[email protected]>
  • Loading branch information
akosyakov committed Sep 3, 2019
1 parent e8811fa commit 3997d85
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
19 changes: 17 additions & 2 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@
"--port=3000",
"--no-cluster",
"--app-project-path=${workspaceRoot}/examples/browser",
"--no-app-auto-install",
"--plugins=local-dir:plugins"
"--plugins=local-dir:plugins",
"--hosted-plugin-inspect=9339"
],
"env": {
"NODE_ENV": "development"
Expand All @@ -75,6 +75,21 @@
"internalConsoleOptions": "openOnSessionStart",
"outputCapture": "std"
},
{
"type": "node",
"request": "attach",
"name": "Attach to Plugin Host",
"port": 9339,
"timeout": 60000,
"stopOnEntry": false,
"smartStep": true,
"sourceMaps": true,
"internalConsoleOptions": "openOnSessionStart",
"outFiles": [
"${workspaceRoot}/packages/plugin-ext/lib/**/*.js",
"${workspaceRoot}/plugins/**/*.js"
]
},
{
"type": "node",
"request": "launch",
Expand Down
10 changes: 10 additions & 0 deletions doc/Developing.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ For Windows instructions [click here](#building-on-windows).
- [Debug the Electron example's backend](#debug-the-electron-examples-backend)
- [Debug the Electron example's frontend](#debug-the-electron-examples-frontend)
- [Debug IPC servers](#debug-ipc-servers)
- [Debug the plugin host](#debug-the-plugin-host)
- [**Profiling**](#profiling)
- [Profile the frontend process](#profile-the-frontend-process)
- [Profile the backend process](#profile-the-backend-process)
Expand Down Expand Up @@ -256,6 +257,15 @@ Let assume you have to work for instance in the `@theia/navigator` extension. Bu
In order to look up `server-name` run the backend server with `--log-level=debug` flag to enable logging of IPC servers instantiation.
You should be able to see message of `[${server-name}: ${server-PID}]: IPC started` format, like `[nsfw-watcher: 37557] IPC started`.

### Debug the plugin host

- Pass `--hosted-plugin-inspect=9339` arg to the backend server from the command line.
- Instead you can run `Launch Backend` launch configuration which is already preconfigured.
- Open the debug view and run the `Attach to Plugin Host` launch configuration.
- It connects to the plugin host if at least one extension is detected, otherwise it timeouts after 60s.
- If you want to debug the activation then enable `stopOnEntry` flag.
- Open the browser page.

## Profiling

- Use Chrome devtools to profile both the frontend and backend (Node.js).
Expand Down

0 comments on commit 3997d85

Please sign in to comment.