Skip to content

Commit

Permalink
Make lint decorations inclusive
Browse files Browse the repository at this point in the history
FIX: Make lint mark decorations inclusive, so that they are applied
even if the marked content is replaced by a widget decoration.

See https://discuss.codemirror.net/t/how-to-mark-decoration-replace-as-error/7590
  • Loading branch information
marijnh committed Dec 18, 2023
1 parent 271b35f commit 88ba8ef
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/lint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@ class LintState {
}).range(d.from)
: Decoration.mark({
attributes: {class: "cm-lintRange cm-lintRange-" + d.severity + (d.markClass ? " " + d.markClass : "")},
diagnostic: d
diagnostic: d,
inclusive: true
}).range(d.from, d.to)
}), true)
return new LintState(ranges, panel, findDiagnostic(ranges))
Expand Down Expand Up @@ -178,7 +179,7 @@ export function diagnosticCount(state: EditorState) {
return lint ? lint.diagnostics.size : 0
}

const activeMark = Decoration.mark({class: "cm-lintRange cm-lintRange-active"})
const activeMark = Decoration.mark({class: "cm-lintRange cm-lintRange-active", inclusive: true})

function lintTooltip(view: EditorView, pos: number, side: -1 | 1) {
let {diagnostics} = view.state.field(lintState)
Expand Down

0 comments on commit 88ba8ef

Please sign in to comment.