@codemirror/lint
Advanced tools
Comparing version 6.2.0 to 6.2.1
@@ -0,1 +1,7 @@ | ||
## 6.2.1 (2023-04-13) | ||
### Bug fixes | ||
The `linter` function now eagerly includes all lint-related extensions, rather than appending them to the configuration as-needed, so that turning off linting by clearing the compartment that contains it works properly. | ||
## 6.2.0 (2023-02-27) | ||
@@ -2,0 +8,0 @@ |
@@ -1,2 +0,2 @@ | ||
import { Decoration, showPanel, EditorView, ViewPlugin, logException, gutter, showTooltip, getPanel, WidgetType, hoverTooltip, GutterMarker } from '@codemirror/view'; | ||
import { Decoration, showPanel, EditorView, ViewPlugin, logException, gutter, showTooltip, hoverTooltip, getPanel, WidgetType, GutterMarker } from '@codemirror/view'; | ||
import { StateEffect, StateField, Facet, combineConfig, RangeSet } from '@codemirror/state'; | ||
@@ -53,13 +53,3 @@ import elt from 'crelt'; | ||
function maybeEnableLint(state, effects) { | ||
return state.field(lintState, false) ? effects : effects.concat(StateEffect.appendConfig.of([ | ||
lintState, | ||
EditorView.decorations.compute([lintState], state => { | ||
let { selected, panel } = state.field(lintState); | ||
return !selected || !panel || selected.from == selected.to ? Decoration.none : Decoration.set([ | ||
activeMark.range(selected.from, selected.to) | ||
]); | ||
}), | ||
hoverTooltip(lintTooltip, { hideOn: hideTooltip }), | ||
baseTheme | ||
])); | ||
return state.field(lintState, false) ? effects : effects.concat(StateEffect.appendConfig.of(lintExtensions)); | ||
} | ||
@@ -252,4 +242,3 @@ /** | ||
})); | ||
}, | ||
enables: lintPlugin | ||
} | ||
}); | ||
@@ -262,3 +251,7 @@ /** | ||
function linter(source, config = {}) { | ||
return lintConfig.of({ source, config }); | ||
return [ | ||
lintConfig.of({ source, config }), | ||
lintPlugin, | ||
lintExtensions | ||
]; | ||
} | ||
@@ -725,2 +718,13 @@ /** | ||
}); | ||
const lintExtensions = [ | ||
lintState, | ||
/*@__PURE__*/EditorView.decorations.compute([lintState], state => { | ||
let { selected, panel } = state.field(lintState); | ||
return !selected || !panel || selected.from == selected.to ? Decoration.none : Decoration.set([ | ||
activeMark.range(selected.from, selected.to) | ||
]); | ||
}), | ||
/*@__PURE__*/hoverTooltip(lintTooltip, { hideOn: hideTooltip }), | ||
baseTheme | ||
]; | ||
const lintGutterConfig = /*@__PURE__*/Facet.define({ | ||
@@ -727,0 +731,0 @@ combine(configs) { |
{ | ||
"name": "@codemirror/lint", | ||
"version": "6.2.0", | ||
"version": "6.2.1", | ||
"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
71119
1683