|
| 1 | +--- |
| 2 | +sidebar_position: 6 |
| 3 | +--- |
| 4 | + |
| 5 | +import Tabs from "@theme/Tabs"; |
| 6 | +import TabItem from "@theme/TabItem"; |
| 7 | +import CodeBlock from "@theme/CodeBlock"; |
| 8 | + |
| 9 | +# Debugging with VS Code |
| 10 | + |
| 11 | +The clients repository ships VS Code launch configurations in its `.vscode` folder, so you can |
| 12 | +attach the debugger to the Desktop app and the Web Vault without any extra setup. Open the **Run and |
| 13 | +Debug** panel and select a configuration from the dropdown. |
| 14 | + |
| 15 | +## Desktop |
| 16 | + |
| 17 | +Electron apps have a renderer process, which runs in the Electron window, and the main process, |
| 18 | +which runs in the background. |
| 19 | + |
| 20 | +Select **`Desktop: Attach Debugger (main + renderer)`** from the Run and Debug dropdown. This |
| 21 | +attaches VSCode's debugger to a running desktop client. You can then set breakpoints directly in the |
| 22 | +TypeScript source. |
| 23 | + |
| 24 | +:::tip |
| 25 | + |
| 26 | +The renderer process can also be inspected using the Chromium DevTools, which open automatically |
| 27 | +when the Desktop app opens, or which you can open from the "View" menu. |
| 28 | + |
| 29 | +::: |
| 30 | + |
| 31 | +## Web Vault |
| 32 | + |
| 33 | +First, build and serve the [Web Vault](./web-vault/index.mdx). |
| 34 | + |
| 35 | +Next, launch Chrome with remote debugging enabled, using a dedicated profile so it doesn't interfere |
| 36 | +with your normal browser session: |
| 37 | + |
| 38 | +<Tabs groupId="os"> |
| 39 | + <TabItem value="mac" label="macOS" default> |
| 40 | + <CodeBlock language="bash">{`open -a "Google Chrome" --args --remote-debugging-port=9223 --user-data-dir=remote-debug-profile`}</CodeBlock> |
| 41 | + </TabItem> |
| 42 | + <TabItem value="win" label="Windows"> |
| 43 | + <CodeBlock language="bash">{`chrome.exe --remote-debugging-port=9223 --user-data-dir=remote-debug-profile`}</CodeBlock> |
| 44 | + </TabItem> |
| 45 | + <TabItem value="lin" label="Linux"> |
| 46 | + <CodeBlock language="bash">{`google-chrome --remote-debugging-port=9223 --user-data-dir=remote-debug-profile`}</CodeBlock> |
| 47 | + </TabItem> |
| 48 | +</Tabs> |
| 49 | + |
| 50 | +Then, in the Chrome instance you just launched, navigate to `https://localhost:8080`. |
| 51 | + |
| 52 | +Finally, in VS Code, select **`Web: Renderer (attach)`** from the Run and Debug dropdown to attach |
| 53 | +the debugger. You can then set breakpoints directly in the TypeScript source. |
0 commit comments