@codemirror/lint 6.9.5 → 6.9.6
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/README.md +2 -2
- package/dist/index.cjs +20 -9
- package/dist/index.js +15 -4
- package/package.json +3 -3
- package/.github/workflows/dispatch.yml +0 -16
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @codemirror/lint [](https://www.npmjs.org/package/@codemirror/lint)
|
|
2
2
|
|
|
3
|
-
[ [**WEBSITE**](https://codemirror.net/) | [**DOCS**](https://codemirror.net/docs/ref/#lint) | [**ISSUES**](https://
|
|
3
|
+
[ [**WEBSITE**](https://codemirror.net/) | [**DOCS**](https://codemirror.net/docs/ref/#lint) | [**ISSUES**](https://code.haverbeke.berlin/codemirror/dev/issues) | [**FORUM**](https://discuss.codemirror.net/) | [**CHANGELOG**](https://code.haverbeke.berlin/codemirror/lint/src/branch/main/CHANGELOG.md) ]
|
|
4
4
|
|
|
5
5
|
This package implements linting support for the
|
|
6
6
|
[CodeMirror](https://codemirror.net/) code editor.
|
|
@@ -10,7 +10,7 @@ number of [examples](https://codemirror.net/examples/) and the
|
|
|
10
10
|
[documentation](https://codemirror.net/docs/).
|
|
11
11
|
|
|
12
12
|
This code is released under an
|
|
13
|
-
[MIT license](https://
|
|
13
|
+
[MIT license](https://code.haverbeke.berlin/codemirror/lint/tree/main/LICENSE).
|
|
14
14
|
|
|
15
15
|
We aim to be an inclusive, welcoming community. To make that explicit,
|
|
16
16
|
we have a [code of
|
package/dist/index.cjs
CHANGED
|
@@ -239,24 +239,29 @@ const closeLintPanel = (view) => {
|
|
|
239
239
|
/**
|
|
240
240
|
Move the selection to the next diagnostic.
|
|
241
241
|
*/
|
|
242
|
-
const nextDiagnostic = (view) => {
|
|
243
|
-
let field = view.state.field(lintState, false);
|
|
242
|
+
const nextDiagnostic = (view$1) => {
|
|
243
|
+
let field = view$1.state.field(lintState, false);
|
|
244
244
|
if (!field)
|
|
245
245
|
return false;
|
|
246
|
-
let sel = view.state.selection.main, next = findDiagnostic(field.diagnostics, null, sel.to + 1);
|
|
246
|
+
let sel = view$1.state.selection.main, next = findDiagnostic(field.diagnostics, null, sel.to + 1);
|
|
247
247
|
if (!next) {
|
|
248
248
|
next = findDiagnostic(field.diagnostics, null, 0);
|
|
249
249
|
if (!next || next.from == sel.from && next.to == sel.to)
|
|
250
250
|
return false;
|
|
251
251
|
}
|
|
252
|
-
view.dispatch({ selection: { anchor: next.from, head: next.to }, scrollIntoView: true });
|
|
252
|
+
view$1.dispatch({ selection: { anchor: next.from, head: next.to }, scrollIntoView: true });
|
|
253
|
+
view.activateHover(view$1, next.from, 1, {
|
|
254
|
+
tooltip: lintHover,
|
|
255
|
+
until: tr => tr.docChanged || tr.newSelection.main.head < next.from || tr.newSelection.main.head > next.to
|
|
256
|
+
});
|
|
253
257
|
return true;
|
|
254
258
|
};
|
|
255
259
|
/**
|
|
256
260
|
Move the selection to the previous diagnostic.
|
|
257
261
|
*/
|
|
258
|
-
const previousDiagnostic = (view) => {
|
|
259
|
-
|
|
262
|
+
const previousDiagnostic = (view$1) => {
|
|
263
|
+
var _a;
|
|
264
|
+
let { state } = view$1, field = state.field(lintState, false);
|
|
260
265
|
if (!field)
|
|
261
266
|
return false;
|
|
262
267
|
let sel = state.selection.main;
|
|
@@ -273,7 +278,12 @@ const previousDiagnostic = (view) => {
|
|
|
273
278
|
});
|
|
274
279
|
if (lastFrom == null || prevFrom == null && lastFrom == sel.from)
|
|
275
280
|
return false;
|
|
276
|
-
|
|
281
|
+
let from = prevFrom !== null && prevFrom !== void 0 ? prevFrom : lastFrom, to = (_a = prevTo !== null && prevTo !== void 0 ? prevTo : lastTo) !== null && _a !== void 0 ? _a : from;
|
|
282
|
+
view$1.dispatch({ selection: { anchor: from, head: to }, scrollIntoView: true });
|
|
283
|
+
view.activateHover(view$1, from, 1, {
|
|
284
|
+
tooltip: lintHover,
|
|
285
|
+
until: tr => tr.docChanged || tr.newSelection.main.head < from || tr.newSelection.main.head > to
|
|
286
|
+
});
|
|
277
287
|
return true;
|
|
278
288
|
};
|
|
279
289
|
/**
|
|
@@ -667,7 +677,7 @@ const baseTheme = view.EditorView.baseTheme({
|
|
|
667
677
|
backgroundRepeat: "repeat-x",
|
|
668
678
|
paddingBottom: "0.7px",
|
|
669
679
|
},
|
|
670
|
-
".cm-lintRange-error": { backgroundImage: underline("#
|
|
680
|
+
".cm-lintRange-error": { backgroundImage: underline("#f11") },
|
|
671
681
|
".cm-lintRange-warning": { backgroundImage: underline("orange") },
|
|
672
682
|
".cm-lintRange-info": { backgroundImage: underline("#999") },
|
|
673
683
|
".cm-lintRange-hint": { backgroundImage: underline("#66d") },
|
|
@@ -886,6 +896,7 @@ const lintGutterTheme = view.EditorView.baseTheme({
|
|
|
886
896
|
content: svg(`<circle cx="20" cy="20" r="15" fill="#f87" stroke="#f43" stroke-width="6"/>`)
|
|
887
897
|
},
|
|
888
898
|
});
|
|
899
|
+
const lintHover = view.hoverTooltip(lintTooltip, { hideOn: hideTooltip });
|
|
889
900
|
const lintExtensions = [
|
|
890
901
|
lintState,
|
|
891
902
|
view.EditorView.decorations.compute([lintState], state => {
|
|
@@ -894,7 +905,7 @@ const lintExtensions = [
|
|
|
894
905
|
activeMark.range(selected.from, selected.to)
|
|
895
906
|
]);
|
|
896
907
|
}),
|
|
897
|
-
|
|
908
|
+
lintHover,
|
|
898
909
|
baseTheme
|
|
899
910
|
];
|
|
900
911
|
const lintGutterConfig = state.Facet.define({
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Decoration, showPanel, EditorView, ViewPlugin, gutter, showTooltip, hoverTooltip, getPanel, logException, WidgetType, GutterMarker } from '@codemirror/view';
|
|
1
|
+
import { Decoration, showPanel, EditorView, ViewPlugin, gutter, showTooltip, hoverTooltip, getPanel, activateHover, logException, WidgetType, GutterMarker } from '@codemirror/view';
|
|
2
2
|
import { StateEffect, StateField, Facet, combineConfig, RangeSet, RangeSetBuilder } from '@codemirror/state';
|
|
3
3
|
import elt from 'crelt';
|
|
4
4
|
|
|
@@ -248,12 +248,17 @@ const nextDiagnostic = (view) => {
|
|
|
248
248
|
return false;
|
|
249
249
|
}
|
|
250
250
|
view.dispatch({ selection: { anchor: next.from, head: next.to }, scrollIntoView: true });
|
|
251
|
+
activateHover(view, next.from, 1, {
|
|
252
|
+
tooltip: lintHover,
|
|
253
|
+
until: tr => tr.docChanged || tr.newSelection.main.head < next.from || tr.newSelection.main.head > next.to
|
|
254
|
+
});
|
|
251
255
|
return true;
|
|
252
256
|
};
|
|
253
257
|
/**
|
|
254
258
|
Move the selection to the previous diagnostic.
|
|
255
259
|
*/
|
|
256
260
|
const previousDiagnostic = (view) => {
|
|
261
|
+
var _a;
|
|
257
262
|
let { state } = view, field = state.field(lintState, false);
|
|
258
263
|
if (!field)
|
|
259
264
|
return false;
|
|
@@ -271,7 +276,12 @@ const previousDiagnostic = (view) => {
|
|
|
271
276
|
});
|
|
272
277
|
if (lastFrom == null || prevFrom == null && lastFrom == sel.from)
|
|
273
278
|
return false;
|
|
274
|
-
|
|
279
|
+
let from = prevFrom !== null && prevFrom !== void 0 ? prevFrom : lastFrom, to = (_a = prevTo !== null && prevTo !== void 0 ? prevTo : lastTo) !== null && _a !== void 0 ? _a : from;
|
|
280
|
+
view.dispatch({ selection: { anchor: from, head: to }, scrollIntoView: true });
|
|
281
|
+
activateHover(view, from, 1, {
|
|
282
|
+
tooltip: lintHover,
|
|
283
|
+
until: tr => tr.docChanged || tr.newSelection.main.head < from || tr.newSelection.main.head > to
|
|
284
|
+
});
|
|
275
285
|
return true;
|
|
276
286
|
};
|
|
277
287
|
/**
|
|
@@ -665,7 +675,7 @@ const baseTheme = /*@__PURE__*/EditorView.baseTheme({
|
|
|
665
675
|
backgroundRepeat: "repeat-x",
|
|
666
676
|
paddingBottom: "0.7px",
|
|
667
677
|
},
|
|
668
|
-
".cm-lintRange-error": { backgroundImage: /*@__PURE__*/underline("#
|
|
678
|
+
".cm-lintRange-error": { backgroundImage: /*@__PURE__*/underline("#f11") },
|
|
669
679
|
".cm-lintRange-warning": { backgroundImage: /*@__PURE__*/underline("orange") },
|
|
670
680
|
".cm-lintRange-info": { backgroundImage: /*@__PURE__*/underline("#999") },
|
|
671
681
|
".cm-lintRange-hint": { backgroundImage: /*@__PURE__*/underline("#66d") },
|
|
@@ -884,6 +894,7 @@ const lintGutterTheme = /*@__PURE__*/EditorView.baseTheme({
|
|
|
884
894
|
content: /*@__PURE__*/svg(`<circle cx="20" cy="20" r="15" fill="#f87" stroke="#f43" stroke-width="6"/>`)
|
|
885
895
|
},
|
|
886
896
|
});
|
|
897
|
+
const lintHover = /*@__PURE__*/hoverTooltip(lintTooltip, { hideOn: hideTooltip });
|
|
887
898
|
const lintExtensions = [
|
|
888
899
|
lintState,
|
|
889
900
|
/*@__PURE__*/EditorView.decorations.compute([lintState], state => {
|
|
@@ -892,7 +903,7 @@ const lintExtensions = [
|
|
|
892
903
|
activeMark.range(selected.from, selected.to)
|
|
893
904
|
]);
|
|
894
905
|
}),
|
|
895
|
-
|
|
906
|
+
lintHover,
|
|
896
907
|
baseTheme
|
|
897
908
|
];
|
|
898
909
|
const lintGutterConfig = /*@__PURE__*/Facet.define({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codemirror/lint",
|
|
3
|
-
"version": "6.9.
|
|
3
|
+
"version": "6.9.6",
|
|
4
4
|
"description": "Linting support for the CodeMirror code editor",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "cm-runtests",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"license": "MIT",
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@codemirror/state": "^6.0.0",
|
|
30
|
-
"@codemirror/view": "^6.
|
|
30
|
+
"@codemirror/view": "^6.42.0",
|
|
31
31
|
"crelt": "^1.0.5"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
@@ -35,6 +35,6 @@
|
|
|
35
35
|
},
|
|
36
36
|
"repository": {
|
|
37
37
|
"type": "git",
|
|
38
|
-
"url": "git+https://
|
|
38
|
+
"url": "git+https://code.haverbeke.berlin/codemirror/lint.git"
|
|
39
39
|
}
|
|
40
40
|
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
name: Trigger CI
|
|
2
|
-
on: push
|
|
3
|
-
|
|
4
|
-
jobs:
|
|
5
|
-
build:
|
|
6
|
-
name: Dispatch to main repo
|
|
7
|
-
runs-on: ubuntu-latest
|
|
8
|
-
steps:
|
|
9
|
-
- name: Emit repository_dispatch
|
|
10
|
-
uses: mvasigh/dispatch-action@main
|
|
11
|
-
with:
|
|
12
|
-
# You should create a personal access token and store it in your repository
|
|
13
|
-
token: ${{ secrets.DISPATCH_AUTH }}
|
|
14
|
-
repo: dev
|
|
15
|
-
owner: codemirror
|
|
16
|
-
event_type: push
|