Skip to content

Commit bcfb0e2

Browse files
AlejandraPedrozadanil-pavlov
authored andcommitted
feat: wasm custom formatters enabled by default (#4733)
* update: wasm custom formatters enabled by default * Aleksey review
1 parent a2e17aa commit bcfb0e2

File tree

1 file changed

+24
-23
lines changed

1 file changed

+24
-23
lines changed

docs/topics/wasm/wasm-debugging.md

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -133,41 +133,42 @@ kotlin {
133133
>
134134
{style="note"}
135135

136-
#### Enhance your debugging with custom formatters
136+
#### Use custom formatters
137137

138-
In addition to the default debugging configuration, you can set up custom formatters to display and locate variable values in a more user-friendly and comprehensible manner.
138+
Custom formatters help display and locate variable values in a more user-friendly and comprehensible manner when debugging Kotlin/Wasm code.
139139

140-
![Kotlin/Wasm improved debugger](wasm-debugger-improved.png){width=600}
140+
Custom formatters are enabled by default in development builds, so you don't need additional Gradle configurations.
141141

142-
This implementation is supported across major browsers like Firefox and Chromium-based as
142+
This feature is supported in Firefox and Chromium-based browsers as
143143
it uses the [custom formatters API](https://firefox-source-docs.mozilla.org/devtools-user/custom_formatters/index.html).
144144

145-
To set up custom formatters for an improved debugging experience:
145+
To use this feature, ensure that custom formatters are enabled in your browser's developer tools:
146146

147-
1. Add the following compiler argument to the `wasmJs` compiler options:
147+
* In Chrome DevTools, find the custom formatters checkbox in **Settings | Preferences | Console**:
148148

149-
```kotlin
150-
kotlin {
151-
wasmJs {
152-
// ...
153-
compilerOptions {
154-
freeCompilerArgs.add("-Xwasm-debugger-custom-formatters")
155-
}
156-
}
157-
}
158-
```
149+
![Enable custom formatters in Chrome](wasm-custom-formatters-chrome.png){width=400}
159150

160-
2. Enable the **Custom formatters** feature in your browser:
151+
* In Firefox DevTools, find the custom formatters checkbox in **Settings | Advanced settings**:
161152

162-
* In the Chrome DevTools, it's placed in **Settings | Preferences | Console**:
153+
![Enable custom formatters in Firefox](wasm-custom-formatters-firefox.png){width=400}
163154

164-
![Enable custom formatters in Chrome](wasm-custom-formatters-chrome.png){width=400}
155+
Custom formatters work for Kotlin/Wasm development builds. If you have specific requirements for production builds,
156+
you need to adjust your Gradle configuration accordingly. Add the following compiler option to the `wasmJs {}` block:
165157

166-
* In the Firefox Developer Tools, it's placed in **Settings | Advanced settings**:
158+
```kotlin
159+
// build.gradle.kts
160+
kotlin {
161+
wasmJs {
162+
// ...
167163

168-
![Enable custom formatters in Firefox](wasm-custom-formatters-firefox.png){width=400}
164+
compilerOptions {
165+
freeCompilerArgs.add("-Xwasm-debugger-custom-formatters")
166+
}
167+
}
168+
}
169+
```
169170

170-
After setting up custom formatters, you can complete the debugging tutorial.
171+
After enabling custom formatters, you can continue with the debugging tutorial.
171172

172173
### Debug your Kotlin/Wasm application
173174

@@ -200,7 +201,7 @@ After setting up custom formatters, you can complete the debugging tutorial.
200201

201202
![Check call stack](wasm-debug-scope.png){width=550}
202203

203-
For an improved visualization of the variable values, see [Enhance your debugging with custom formatters](#enhance-your-debugging-with-custom-formatters).
204+
For an improved visualization of the variable values, see _Use custom formatters_ within the [Configure your browser for debugging](#configure-your-browser-for-debugging) section.
204205

205206
7. Make changes to your code and [run the application](#run-the-application) again to verify that everything works as expected.
206207
8. Click on the line numbers with breakpoints to remove the breakpoints.

0 commit comments

Comments
 (0)