@codemirror/lint 6.9.0 → 6.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/index.cjs +24 -1
- package/dist/index.js +24 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -24,6 +24,7 @@ class LintState {
|
|
|
24
24
|
diagnostics = diagnosticFilter(diagnostics, state$1);
|
|
25
25
|
let sorted = diagnostics.slice().sort((a, b) => a.from - b.from || a.to - b.to);
|
|
26
26
|
let deco = new state.RangeSetBuilder(), active = [], pos = 0;
|
|
27
|
+
let scan = state$1.doc.iter(), scanPos = 0;
|
|
27
28
|
for (let i = 0;;) {
|
|
28
29
|
let next = i == sorted.length ? null : sorted[i];
|
|
29
30
|
if (!next && !active.length)
|
|
@@ -51,8 +52,30 @@ class LintState {
|
|
|
51
52
|
break;
|
|
52
53
|
}
|
|
53
54
|
}
|
|
55
|
+
let widget = false;
|
|
56
|
+
if (active.some(d => d.from == from && d.to == to)) {
|
|
57
|
+
widget = from == to;
|
|
58
|
+
if (!widget && to - from < 10) {
|
|
59
|
+
let behind = from - (scanPos + scan.value.length);
|
|
60
|
+
if (behind > 0) {
|
|
61
|
+
scan.next(behind);
|
|
62
|
+
scanPos = from;
|
|
63
|
+
}
|
|
64
|
+
for (let check = from;;) {
|
|
65
|
+
if (check >= to) {
|
|
66
|
+
widget = true;
|
|
67
|
+
break;
|
|
68
|
+
}
|
|
69
|
+
if (!scan.lineBreak && scanPos + scan.value.length > check)
|
|
70
|
+
break;
|
|
71
|
+
check = scanPos + scan.value.length;
|
|
72
|
+
scanPos += scan.value.length;
|
|
73
|
+
scan.next();
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
54
77
|
let sev = maxSeverity(active);
|
|
55
|
-
if (
|
|
78
|
+
if (widget) {
|
|
56
79
|
deco.add(from, from, view.Decoration.widget({
|
|
57
80
|
widget: new DiagnosticWidget(sev),
|
|
58
81
|
diagnostics: active.slice()
|
package/dist/index.js
CHANGED
|
@@ -22,6 +22,7 @@ class LintState {
|
|
|
22
22
|
diagnostics = diagnosticFilter(diagnostics, state);
|
|
23
23
|
let sorted = diagnostics.slice().sort((a, b) => a.from - b.from || a.to - b.to);
|
|
24
24
|
let deco = new RangeSetBuilder(), active = [], pos = 0;
|
|
25
|
+
let scan = state.doc.iter(), scanPos = 0;
|
|
25
26
|
for (let i = 0;;) {
|
|
26
27
|
let next = i == sorted.length ? null : sorted[i];
|
|
27
28
|
if (!next && !active.length)
|
|
@@ -49,8 +50,30 @@ class LintState {
|
|
|
49
50
|
break;
|
|
50
51
|
}
|
|
51
52
|
}
|
|
53
|
+
let widget = false;
|
|
54
|
+
if (active.some(d => d.from == from && d.to == to)) {
|
|
55
|
+
widget = from == to;
|
|
56
|
+
if (!widget && to - from < 10) {
|
|
57
|
+
let behind = from - (scanPos + scan.value.length);
|
|
58
|
+
if (behind > 0) {
|
|
59
|
+
scan.next(behind);
|
|
60
|
+
scanPos = from;
|
|
61
|
+
}
|
|
62
|
+
for (let check = from;;) {
|
|
63
|
+
if (check >= to) {
|
|
64
|
+
widget = true;
|
|
65
|
+
break;
|
|
66
|
+
}
|
|
67
|
+
if (!scan.lineBreak && scanPos + scan.value.length > check)
|
|
68
|
+
break;
|
|
69
|
+
check = scanPos + scan.value.length;
|
|
70
|
+
scanPos += scan.value.length;
|
|
71
|
+
scan.next();
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
52
75
|
let sev = maxSeverity(active);
|
|
53
|
-
if (
|
|
76
|
+
if (widget) {
|
|
54
77
|
deco.add(from, from, Decoration.widget({
|
|
55
78
|
widget: new DiagnosticWidget(sev),
|
|
56
79
|
diagnostics: active.slice()
|