@codemirror/lint 6.5.0 → 6.6.0
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 +7 -2
- package/dist/index.d.cts +9 -1
- package/dist/index.d.ts +9 -1
- package/dist/index.js +7 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -50,8 +50,12 @@ function findDiagnostic(diagnostics, diagnostic = null, after = 0) {
|
|
|
50
50
|
return found;
|
|
51
51
|
}
|
|
52
52
|
function hideTooltip(tr, tooltip) {
|
|
53
|
+
let from = tooltip.pos, to = tooltip.end || from;
|
|
54
|
+
let result = tr.state.facet(lintConfig).hideOn(tr, from, to);
|
|
55
|
+
if (result != null)
|
|
56
|
+
return result;
|
|
53
57
|
let line = tr.startState.doc.lineAt(tooltip.pos);
|
|
54
|
-
return !!(tr.effects.some(e => e.is(setDiagnosticsEffect)) || tr.changes.touchesRange(line.from, line.to));
|
|
58
|
+
return !!(tr.effects.some(e => e.is(setDiagnosticsEffect)) || tr.changes.touchesRange(line.from, Math.max(line.to, to)));
|
|
55
59
|
}
|
|
56
60
|
function maybeEnableLint(state$1, effects) {
|
|
57
61
|
return state$1.field(lintState, false) ? effects : effects.concat(state.StateEffect.appendConfig.of(lintExtensions));
|
|
@@ -263,7 +267,8 @@ const lintConfig = state.Facet.define({
|
|
|
263
267
|
delay: 750,
|
|
264
268
|
markerFilter: null,
|
|
265
269
|
tooltipFilter: null,
|
|
266
|
-
needsRefresh: null
|
|
270
|
+
needsRefresh: null,
|
|
271
|
+
hideOn: () => null,
|
|
267
272
|
}, {
|
|
268
273
|
needsRefresh: (a, b) => !a ? b : !b ? a : u => a(u) || b(u)
|
|
269
274
|
}));
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _codemirror_state from '@codemirror/state';
|
|
2
|
-
import { EditorState, TransactionSpec, Extension } from '@codemirror/state';
|
|
2
|
+
import { EditorState, TransactionSpec, Extension, Transaction } from '@codemirror/state';
|
|
3
3
|
import { EditorView, Command, KeyBinding, ViewUpdate } from '@codemirror/view';
|
|
4
4
|
|
|
5
5
|
type Severity = "hint" | "info" | "warning" | "error";
|
|
@@ -85,6 +85,14 @@ interface LintConfig {
|
|
|
85
85
|
tooltip will appear if the empty set is returned.
|
|
86
86
|
*/
|
|
87
87
|
tooltipFilter?: null | DiagnosticFilter;
|
|
88
|
+
/**
|
|
89
|
+
Can be used to control what kind of transactions cause lint
|
|
90
|
+
hover tooltips associated with the given document range to be
|
|
91
|
+
hidden. By default any transactions that changes the line
|
|
92
|
+
around the range will hide it. Returning null falls back to this
|
|
93
|
+
behavior.
|
|
94
|
+
*/
|
|
95
|
+
hideOn?: (tr: Transaction, from: number, to: number) => boolean | null;
|
|
88
96
|
}
|
|
89
97
|
interface LintGutterConfig {
|
|
90
98
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _codemirror_state from '@codemirror/state';
|
|
2
|
-
import { EditorState, TransactionSpec, Extension } from '@codemirror/state';
|
|
2
|
+
import { EditorState, TransactionSpec, Extension, Transaction } from '@codemirror/state';
|
|
3
3
|
import { EditorView, Command, KeyBinding, ViewUpdate } from '@codemirror/view';
|
|
4
4
|
|
|
5
5
|
type Severity = "hint" | "info" | "warning" | "error";
|
|
@@ -85,6 +85,14 @@ interface LintConfig {
|
|
|
85
85
|
tooltip will appear if the empty set is returned.
|
|
86
86
|
*/
|
|
87
87
|
tooltipFilter?: null | DiagnosticFilter;
|
|
88
|
+
/**
|
|
89
|
+
Can be used to control what kind of transactions cause lint
|
|
90
|
+
hover tooltips associated with the given document range to be
|
|
91
|
+
hidden. By default any transactions that changes the line
|
|
92
|
+
around the range will hide it. Returning null falls back to this
|
|
93
|
+
behavior.
|
|
94
|
+
*/
|
|
95
|
+
hideOn?: (tr: Transaction, from: number, to: number) => boolean | null;
|
|
88
96
|
}
|
|
89
97
|
interface LintGutterConfig {
|
|
90
98
|
/**
|
package/dist/index.js
CHANGED
|
@@ -48,8 +48,12 @@ function findDiagnostic(diagnostics, diagnostic = null, after = 0) {
|
|
|
48
48
|
return found;
|
|
49
49
|
}
|
|
50
50
|
function hideTooltip(tr, tooltip) {
|
|
51
|
+
let from = tooltip.pos, to = tooltip.end || from;
|
|
52
|
+
let result = tr.state.facet(lintConfig).hideOn(tr, from, to);
|
|
53
|
+
if (result != null)
|
|
54
|
+
return result;
|
|
51
55
|
let line = tr.startState.doc.lineAt(tooltip.pos);
|
|
52
|
-
return !!(tr.effects.some(e => e.is(setDiagnosticsEffect)) || tr.changes.touchesRange(line.from, line.to));
|
|
56
|
+
return !!(tr.effects.some(e => e.is(setDiagnosticsEffect)) || tr.changes.touchesRange(line.from, Math.max(line.to, to)));
|
|
53
57
|
}
|
|
54
58
|
function maybeEnableLint(state, effects) {
|
|
55
59
|
return state.field(lintState, false) ? effects : effects.concat(StateEffect.appendConfig.of(lintExtensions));
|
|
@@ -261,7 +265,8 @@ const lintConfig = /*@__PURE__*/Facet.define({
|
|
|
261
265
|
delay: 750,
|
|
262
266
|
markerFilter: null,
|
|
263
267
|
tooltipFilter: null,
|
|
264
|
-
needsRefresh: null
|
|
268
|
+
needsRefresh: null,
|
|
269
|
+
hideOn: () => null,
|
|
265
270
|
}, {
|
|
266
271
|
needsRefresh: (a, b) => !a ? b : !b ? a : u => a(u) || b(u)
|
|
267
272
|
}));
|