@codemirror/lint
Advanced tools
Comparing version 0.19.3 to 0.19.4
@@ -0,1 +1,11 @@ | ||
## 0.19.4 (2022-02-25) | ||
### Bug fixes | ||
Fix an issue where an outdated marker could stick around on the lint gutter after all diagnostics were removed. | ||
### New features | ||
Add a `hoverTime` option to the lint gutter. Change default hover time to 300 | ||
## 0.19.3 (2021-11-09) | ||
@@ -2,0 +12,0 @@ |
@@ -54,2 +54,8 @@ import * as _codemirror_state from '@codemirror/state'; | ||
} | ||
interface LintGutterConfig { | ||
/** | ||
The delay before showing a tooltip when hovering over a lint gutter marker. | ||
*/ | ||
hoverTime?: number; | ||
} | ||
/** | ||
@@ -112,4 +118,4 @@ Returns a transaction spec which updates the current set of | ||
*/ | ||
declare function lintGutter(): Extension; | ||
declare function lintGutter(config?: LintGutterConfig): Extension; | ||
export { Action, Diagnostic, closeLintPanel, diagnosticCount, forceLinting, lintGutter, lintKeymap, linter, nextDiagnostic, openLintPanel, setDiagnostics, setDiagnosticsEffect }; |
import { Decoration, EditorView, ViewPlugin, logException, WidgetType } from '@codemirror/view'; | ||
import { StateEffect, StateField, Facet } from '@codemirror/state'; | ||
import { StateEffect, StateField, Facet, combineConfig } from '@codemirror/state'; | ||
import { hoverTooltip, showTooltip } from '@codemirror/tooltip'; | ||
@@ -207,6 +207,4 @@ import { showPanel, getPanel } from '@codemirror/panel'; | ||
Promise.all(sources.map(source => Promise.resolve(source(this.view)))).then(annotations => { | ||
var _a, _b; | ||
let all = annotations.reduce((a, b) => a.concat(b)); | ||
if (this.view.state.doc == state.doc && | ||
(all.length || ((_b = (_a = this.view.state.field(lintState, false)) === null || _a === void 0 ? void 0 : _a.diagnostics) === null || _b === void 0 ? void 0 : _b.size))) | ||
if (this.view.state.doc == state.doc) | ||
this.view.dispatch(setDiagnostics(this.view.state, all)); | ||
@@ -609,3 +607,3 @@ }, error => { logException(this.view.state, error); }); | ||
function hovered() { | ||
let line = view.visualLineAtHeight(marker.getBoundingClientRect().top + 5); | ||
let line = view.visualLineAtHeight(marker.getBoundingClientRect().top + 5 - view.documentTop); | ||
const linePos = view.coordsAtPos(line.from), markerRect = marker.getBoundingClientRect(); | ||
@@ -627,3 +625,4 @@ if (linePos) { | ||
} | ||
let hoverTimeout = setTimeout(hovered, 600 /* Time */); | ||
let { hoverTime } = view.state.facet(lintGutterConfig); | ||
let hoverTimeout = setTimeout(hovered, hoverTime); | ||
marker.onmouseout = () => { | ||
@@ -635,3 +634,3 @@ clearTimeout(hoverTimeout); | ||
clearTimeout(hoverTimeout); | ||
hoverTimeout = setTimeout(hovered, 600 /* Time */); | ||
hoverTimeout = setTimeout(hovered, hoverTime); | ||
}; | ||
@@ -702,2 +701,9 @@ } | ||
}); | ||
const lintGutterConfig = /*@__PURE__*/Facet.define({ | ||
combine(configs) { | ||
return combineConfig(configs, { | ||
hoverTime: 300 /* Time */, | ||
}); | ||
} | ||
}); | ||
/** | ||
@@ -708,6 +714,6 @@ Returns an extension that installs a gutter showing markers for | ||
*/ | ||
function lintGutter() { | ||
return [lintGutterMarkers, lintGutterExtension, lintGutterTheme, lintGutterTooltip]; | ||
function lintGutter(config = {}) { | ||
return [lintGutterConfig.of(config), lintGutterMarkers, lintGutterExtension, lintGutterTheme, lintGutterTooltip]; | ||
} | ||
export { closeLintPanel, diagnosticCount, forceLinting, lintGutter, lintKeymap, linter, nextDiagnostic, openLintPanel, setDiagnostics, setDiagnosticsEffect }; |
{ | ||
"name": "@codemirror/lint", | ||
"version": "0.19.3", | ||
"version": "0.19.4", | ||
"description": "Linting support for the CodeMirror code editor", | ||
@@ -34,3 +34,3 @@ "scripts": { | ||
"@codemirror/tooltip": "^0.19.5", | ||
"@codemirror/view": "^0.19.0", | ||
"@codemirror/view": "^0.19.22", | ||
"crelt": "^1.0.5" | ||
@@ -37,0 +37,0 @@ }, |
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
63994
1549
Updated@codemirror/view@^0.19.22