Skip to content

Commit

Permalink
Add widgetMarker option to lint gutter
Browse files Browse the repository at this point in the history
FIX: Show lint markers for code replaced by a block widget.
  • Loading branch information
hubgit authored and marijnh committed Jul 25, 2024
1 parent 8b2eb06 commit c13331c
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/lint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -800,6 +800,13 @@ function markersForDiagnostics(doc: Text, diagnostics: readonly Diagnostic[]) {
const lintGutterExtension = gutter({
class: "cm-gutter-lint",
markers: view => view.state.field(lintGutterMarkers),
widgetMarker: (view, widget, block) => {
let diagnostics: Diagnostic[] = []
view.state.field(lintGutterMarkers).between(block.from, block.to, (from, to, value) => {
diagnostics.push(...(value as LintGutterMarker).diagnostics)
})
return diagnostics.length ? new LintGutterMarker(diagnostics) : null
}
})

const lintGutterMarkers = StateField.define<RangeSet<GutterMarker>>({
Expand Down

0 comments on commit c13331c

Please sign in to comment.