@codemirror/lint 6.9.0 → 6.9.2
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 +12 -0
- package/dist/index.cjs +29 -1
- package/dist/index.js +29 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
## 6.9.2 (2025-11-03)
|
|
2
|
+
|
|
3
|
+
### Bug fixes
|
|
4
|
+
|
|
5
|
+
Fix an infinite loop that would occur when a diagnostic pointed beyond the end of the document.
|
|
6
|
+
|
|
7
|
+
## 6.9.1 (2025-10-23)
|
|
8
|
+
|
|
9
|
+
### Bug fixes
|
|
10
|
+
|
|
11
|
+
Properly display diagnostics that just cover multiple newlines as widgets.
|
|
12
|
+
|
|
1
13
|
## 6.9.0 (2025-10-02)
|
|
2
14
|
|
|
3
15
|
### Bug fixes
|
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, docLen = state$1.doc.length;
|
|
27
28
|
for (let i = 0;;) {
|
|
28
29
|
let next = i == sorted.length ? null : sorted[i];
|
|
29
30
|
if (!next && !active.length)
|
|
@@ -35,6 +36,8 @@ class LintState {
|
|
|
35
36
|
}
|
|
36
37
|
else {
|
|
37
38
|
from = next.from;
|
|
39
|
+
if (from > docLen)
|
|
40
|
+
break;
|
|
38
41
|
to = next.to;
|
|
39
42
|
active.push(next);
|
|
40
43
|
i++;
|
|
@@ -51,8 +54,31 @@ class LintState {
|
|
|
51
54
|
break;
|
|
52
55
|
}
|
|
53
56
|
}
|
|
57
|
+
to = Math.min(to, docLen);
|
|
58
|
+
let widget = false;
|
|
59
|
+
if (active.some(d => d.from == from && (d.to == to || to == docLen))) {
|
|
60
|
+
widget = from == to;
|
|
61
|
+
if (!widget && to - from < 10) {
|
|
62
|
+
let behind = from - (scanPos + scan.value.length);
|
|
63
|
+
if (behind > 0) {
|
|
64
|
+
scan.next(behind);
|
|
65
|
+
scanPos = from;
|
|
66
|
+
}
|
|
67
|
+
for (let check = from;;) {
|
|
68
|
+
if (check >= to) {
|
|
69
|
+
widget = true;
|
|
70
|
+
break;
|
|
71
|
+
}
|
|
72
|
+
if (!scan.lineBreak && scanPos + scan.value.length > check)
|
|
73
|
+
break;
|
|
74
|
+
check = scanPos + scan.value.length;
|
|
75
|
+
scanPos += scan.value.length;
|
|
76
|
+
scan.next();
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
54
80
|
let sev = maxSeverity(active);
|
|
55
|
-
if (
|
|
81
|
+
if (widget) {
|
|
56
82
|
deco.add(from, from, view.Decoration.widget({
|
|
57
83
|
widget: new DiagnosticWidget(sev),
|
|
58
84
|
diagnostics: active.slice()
|
|
@@ -67,6 +93,8 @@ class LintState {
|
|
|
67
93
|
}));
|
|
68
94
|
}
|
|
69
95
|
pos = to;
|
|
96
|
+
if (pos == docLen)
|
|
97
|
+
break;
|
|
70
98
|
for (let i = 0; i < active.length; i++)
|
|
71
99
|
if (active[i].to <= pos)
|
|
72
100
|
active.splice(i--, 1);
|
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, docLen = state.doc.length;
|
|
25
26
|
for (let i = 0;;) {
|
|
26
27
|
let next = i == sorted.length ? null : sorted[i];
|
|
27
28
|
if (!next && !active.length)
|
|
@@ -33,6 +34,8 @@ class LintState {
|
|
|
33
34
|
}
|
|
34
35
|
else {
|
|
35
36
|
from = next.from;
|
|
37
|
+
if (from > docLen)
|
|
38
|
+
break;
|
|
36
39
|
to = next.to;
|
|
37
40
|
active.push(next);
|
|
38
41
|
i++;
|
|
@@ -49,8 +52,31 @@ class LintState {
|
|
|
49
52
|
break;
|
|
50
53
|
}
|
|
51
54
|
}
|
|
55
|
+
to = Math.min(to, docLen);
|
|
56
|
+
let widget = false;
|
|
57
|
+
if (active.some(d => d.from == from && (d.to == to || to == docLen))) {
|
|
58
|
+
widget = from == to;
|
|
59
|
+
if (!widget && to - from < 10) {
|
|
60
|
+
let behind = from - (scanPos + scan.value.length);
|
|
61
|
+
if (behind > 0) {
|
|
62
|
+
scan.next(behind);
|
|
63
|
+
scanPos = from;
|
|
64
|
+
}
|
|
65
|
+
for (let check = from;;) {
|
|
66
|
+
if (check >= to) {
|
|
67
|
+
widget = true;
|
|
68
|
+
break;
|
|
69
|
+
}
|
|
70
|
+
if (!scan.lineBreak && scanPos + scan.value.length > check)
|
|
71
|
+
break;
|
|
72
|
+
check = scanPos + scan.value.length;
|
|
73
|
+
scanPos += scan.value.length;
|
|
74
|
+
scan.next();
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
52
78
|
let sev = maxSeverity(active);
|
|
53
|
-
if (
|
|
79
|
+
if (widget) {
|
|
54
80
|
deco.add(from, from, Decoration.widget({
|
|
55
81
|
widget: new DiagnosticWidget(sev),
|
|
56
82
|
diagnostics: active.slice()
|
|
@@ -65,6 +91,8 @@ class LintState {
|
|
|
65
91
|
}));
|
|
66
92
|
}
|
|
67
93
|
pos = to;
|
|
94
|
+
if (pos == docLen)
|
|
95
|
+
break;
|
|
68
96
|
for (let i = 0; i < active.length; i++)
|
|
69
97
|
if (active[i].to <= pos)
|
|
70
98
|
active.splice(i--, 1);
|