@codemirror/lint
Advanced tools
Comparing version 6.1.1 to 6.2.0
@@ -0,1 +1,7 @@ | ||
## 6.2.0 (2023-02-27) | ||
### New features | ||
The new `needsRefresh` option to `linter` makes it possible to cause linting to be recalculated for non-document state changes. | ||
## 6.1.1 (2023-02-15) | ||
@@ -2,0 +8,0 @@ |
import * as _codemirror_state from '@codemirror/state'; | ||
import { EditorState, TransactionSpec, Extension } from '@codemirror/state'; | ||
import { EditorView, Command, KeyBinding } from '@codemirror/view'; | ||
import { EditorView, Command, KeyBinding, ViewUpdate } from '@codemirror/view'; | ||
@@ -67,2 +67,8 @@ /** | ||
/** | ||
Optional predicate that can be used to indicate when diagnostics | ||
need to be recomputed. Linting is always re-done on document | ||
changes. | ||
*/ | ||
needsRefresh?: null | ((update: ViewUpdate) => boolean); | ||
/** | ||
Optional filter to determine which diagnostics produce markers | ||
@@ -69,0 +75,0 @@ in the content. |
@@ -222,3 +222,4 @@ import { Decoration, showPanel, EditorView, ViewPlugin, logException, gutter, showTooltip, getPanel, WidgetType, hoverTooltip, GutterMarker } from '@codemirror/view'; | ||
let config = update.state.facet(lintConfig); | ||
if (update.docChanged || config != update.startState.facet(lintConfig)) { | ||
if (update.docChanged || config != update.startState.facet(lintConfig) || | ||
config.needsRefresh && config.needsRefresh(update)) { | ||
this.lintTime = Date.now() + config.delay; | ||
@@ -246,3 +247,6 @@ if (!this.set) { | ||
markerFilter: null, | ||
tooltipFilter: null | ||
tooltipFilter: null, | ||
needsRefresh: null | ||
}, { | ||
needsRefresh: (a, b) => !a ? b : !b ? a : u => a(u) || b(u) | ||
})); | ||
@@ -249,0 +253,0 @@ }, |
{ | ||
"name": "@codemirror/lint", | ||
"version": "6.1.1", | ||
"version": "6.2.0", | ||
"description": "Linting support for the CodeMirror code editor", | ||
@@ -5,0 +5,0 @@ "scripts": { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
70766
1675