Skip to content

Commit 446bf06

Browse files
authored
[BEEEP] [PM-38497] Dev-ex: Add note for Add attach VSCode debugger to desktop, web configs (#813)
* Add notes about attaching debuggers * Cleanup
1 parent d4f3bbc commit 446bf06

3 files changed

Lines changed: 61 additions & 10 deletions

File tree

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
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.

docs/getting-started/clients/desktop/index.mdx

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -101,17 +101,10 @@ cd apps/desktop
101101
npm run electron
102102
```
103103

104-
## Debugging and testing
104+
## Debugging
105105

106-
Electron apps have a renderer process, which runs in the Electron window, and the main process,
107-
which runs in the background.
108-
109-
The renderer process can be inspected using the Chromium debugger. It should open automatically when
110-
the Desktop app opens, or you can open it from the “View” menu.
111-
112-
The main process can be debugged by running the app from a
113-
[Javascript Debug Terminal](https://code.visualstudio.com/docs/nodejs/nodejs-debugging#_javascript-debug-terminal)
114-
in Visual Studio Code and then placing breakpoints in `build/main.js`.
106+
See [Debugging with VS Code](../debugging.mdx#desktop) for how to attach the VS Code debugger to the
107+
main and renderer processes.
115108

116109
## Biometric unlock (Native Messaging)
117110

docs/getting-started/clients/web-vault/index.mdx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,3 +139,8 @@ following structure:
139139
[^1]:
140140
`urls` adhere to the
141141
[type definition in `EnvironmentService`](https://github.com/bitwarden/clients/blob/main/libs/common/src/platform/abstractions/environment.service.ts).
142+
143+
## Debugging
144+
145+
See [Debugging with VS Code](../debugging.mdx#web-vault) for how to attach the VS Code debugger to
146+
the Web Vault running in Chrome.

0 commit comments

Comments
 (0)