diff --git a/.vscode/launch.json b/.vscode/launch.json index 0768794112228..6f3facdbdc819 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -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" @@ -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", diff --git a/doc/Developing.md b/doc/Developing.md index 3941345bdc119..66c909a14b9fb 100644 --- a/doc/Developing.md +++ b/doc/Developing.md @@ -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) @@ -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).