You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/guide/diagnostics.md
+10-10Lines changed: 10 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -52,7 +52,7 @@ export function MyPlugin(): PluginWithDevTools {
52
52
ctx.diagnostics.register(myDiagnostics)
53
53
54
54
// Emit through the host's shared reporter:
55
-
myDiagnostics.MYP0002.report()
55
+
myDiagnostics.MYP0002()
56
56
},
57
57
},
58
58
}
@@ -76,26 +76,26 @@ Each definition supports a `why` (string or function — the message) and an opt
76
76
77
77
## Emit a diagnostic
78
78
79
-
Each registered code becomes a `DiagnosticHandle` on the typed result of `defineDiagnostics()` (and through the shared `ctx.diagnostics.logger` lookup). Handles expose `.report()` and `.throw()`.
79
+
Each registered code becomes a `DiagnosticHandle` on the typed result of `defineDiagnostics()` (and through the shared `ctx.diagnostics.logger` lookup). Each handle is a callable — invoke it to report (returns the `Diagnostic`), or prefix with `throw` to raise.
80
80
81
81
```ts
82
82
// Throw — control flow stops here
83
-
throwmyDiagnostics.MYP0001.throw({ name: 'foo' })
83
+
throwmyDiagnostics.MYP0001({ name: 'foo' })
84
84
85
85
// Report without throwing (default console method: `warn`)
-**`ctx.messages`** — user-facing activity surfaces in the DevTools UI: progress indicators, audit results, "URL copied" toasts. Just a message and a level.
139
139
140
140
Diagnostics target tool authors and CI; messages target the human in front of the DevTools panel.
0 commit comments