diagnosticsAPI
MS Code Extension API / core/extensionAPI/modules/languages/diagnosticsAPI
core/extensionAPI/modules/languages/diagnosticsAPI
Functions
createDiagnosticsAPI()
createDiagnosticsAPI(
extId):object
Defined in: core/extensionAPI/modules/languages/diagnosticsAPI.ts:13
Factory function to create the Diagnostics API. Enables extensions to read, publish, or listen to code warnings, errors, and linting markers.
Parameters
extId
string
The unique identifier of the extension.
Returns
createDiagnosticCollection
createDiagnosticCollection: (
name) =>object
Creates a dedicated container for diagnostic markers. Useful for linking custom external linters, builders, or toolchains (e.g., ESLint).
Parameters
name
string
The human-readable name of the collection.
Returns
An object managing the collection lifetime and markers state.
clear
clear: () =>
void
Wipes all active diagnostic markers published by this specific collection instance.
Returns
void
dispose
dispose: () =>
void
Disposes the collection container and clears all of its registered markers.
Returns
void
name
name:
string
set
set: (
uri,diagnostics) =>void
Publishes an array of diagnostics for a specific file resource path. This triggers native Monaco editor squiggles and updates the UI Problems Panel.
Parameters
uri
string
The absolute target document URI string.
diagnostics
IMarkerData[]
The markers metadata payload array.
Returns
void
getDiagnostics
getDiagnostics: (
uri?) =>IMarker[]
Retrieves all currently active diagnostics (problems) in the editor workspace.
Parameters
uri?
string
Optional target file URI to filter diagnostics.
Returns
IMarker[]
Array of diagnostic markers matching the criteria.
onDidChangeDiagnostics
onDidChangeDiagnostics: (
handler) =>object
Fired globally when file markers or diagnostics are added, changed, or completely cleared.
Parameters
handler
(diagnostics) => void
Callback invoked when a system diagnostics sync occurs.
Returns
object
A disposable instance object to detach the event listener hook securely.
dispose
dispose: () =>
void
Returns
void