@codemirror/lint
Advanced tools
+10
-0
@@ -0,1 +1,11 @@ | ||
| ## 6.9.0 (2025-10-02) | ||
| ### Bug fixes | ||
| Multiple configurations to `linter` will now be merged without raising an error. | ||
| ### New features | ||
| The new `markClass` option to actions makes it possible to style action buttons. | ||
| ## 6.8.5 (2025-03-26) | ||
@@ -2,0 +12,0 @@ |
+28
-13
@@ -322,18 +322,32 @@ 'use strict'; | ||
| combine(input) { | ||
| return Object.assign({ sources: input.map(i => i.source).filter(x => x != null) }, state.combineConfig(input.map(i => i.config), { | ||
| delay: 750, | ||
| markerFilter: null, | ||
| tooltipFilter: null, | ||
| needsRefresh: null, | ||
| hideOn: () => null, | ||
| }, { | ||
| needsRefresh: (a, b) => !a ? b : !b ? a : u => a(u) || b(u) | ||
| })); | ||
| return { | ||
| sources: input.map(i => i.source).filter(x => x != null), | ||
| ...state.combineConfig(input.map(i => i.config), { | ||
| delay: 750, | ||
| markerFilter: null, | ||
| tooltipFilter: null, | ||
| needsRefresh: null, | ||
| hideOn: () => null, | ||
| }, { | ||
| delay: Math.max, | ||
| markerFilter: combineFilter, | ||
| tooltipFilter: combineFilter, | ||
| needsRefresh: (a, b) => !a ? b : !b ? a : u => a(u) || b(u), | ||
| hideOn: (a, b) => !a ? b : !b ? a : (t, x, y) => a(t, x, y) || b(t, x, y), | ||
| autoPanel: (a, b) => a || b | ||
| }) | ||
| }; | ||
| } | ||
| }); | ||
| function combineFilter(a, b) { | ||
| return !a ? b : !b ? a : (d, s) => b(a(d, s), s); | ||
| } | ||
| /** | ||
| Given a diagnostic source, this function returns an extension that | ||
| enables linting with that source. It will be called whenever the | ||
| editor is idle (after its content changed). If `null` is given as | ||
| source, this only configures the lint extension. | ||
| editor is idle (after its content changed). | ||
| Note that settings given here will apply to all linters active in | ||
| the editor. If `null` is given as source, this only configures the | ||
| lint extension. | ||
| */ | ||
@@ -388,5 +402,6 @@ function linter(source, config = {}) { | ||
| name.slice(keyIndex + 1)]; | ||
| let markClass = action.markClass ? " " + action.markClass : ""; | ||
| return elt("button", { | ||
| type: "button", | ||
| class: "cm-diagnosticAction", | ||
| class: "cm-diagnosticAction" + markClass, | ||
| onclick: click, | ||
@@ -814,3 +829,3 @@ onmousedown: click, | ||
| if (tooltip && tr.docChanged) | ||
| tooltip = hideTooltip(tr, tooltip) ? null : Object.assign(Object.assign({}, tooltip), { pos: tr.changes.mapPos(tooltip.pos) }); | ||
| tooltip = hideTooltip(tr, tooltip) ? null : { ...tooltip, pos: tr.changes.mapPos(tooltip.pos) }; | ||
| return tr.effects.reduce((t, e) => e.is(setLintGutterTooltip) ? e.value : t, tooltip); | ||
@@ -817,0 +832,0 @@ }, |
+9
-2
@@ -59,2 +59,6 @@ import * as _codemirror_state from '@codemirror/state'; | ||
| /** | ||
| When given, add an extra CSS class to the action button. | ||
| */ | ||
| markClass?: string; | ||
| /** | ||
| The function to call when the user activates this action. Is | ||
@@ -165,4 +169,7 @@ given the diagnostic's _current_ position, which may have | ||
| enables linting with that source. It will be called whenever the | ||
| editor is idle (after its content changed). If `null` is given as | ||
| source, this only configures the lint extension. | ||
| editor is idle (after its content changed). | ||
| Note that settings given here will apply to all linters active in | ||
| the editor. If `null` is given as source, this only configures the | ||
| lint extension. | ||
| */ | ||
@@ -169,0 +176,0 @@ declare function linter(source: LintSource | null, config?: LintConfig): Extension; |
+9
-2
@@ -59,2 +59,6 @@ import * as _codemirror_state from '@codemirror/state'; | ||
| /** | ||
| When given, add an extra CSS class to the action button. | ||
| */ | ||
| markClass?: string; | ||
| /** | ||
| The function to call when the user activates this action. Is | ||
@@ -165,4 +169,7 @@ given the diagnostic's _current_ position, which may have | ||
| enables linting with that source. It will be called whenever the | ||
| editor is idle (after its content changed). If `null` is given as | ||
| source, this only configures the lint extension. | ||
| editor is idle (after its content changed). | ||
| Note that settings given here will apply to all linters active in | ||
| the editor. If `null` is given as source, this only configures the | ||
| lint extension. | ||
| */ | ||
@@ -169,0 +176,0 @@ declare function linter(source: LintSource | null, config?: LintConfig): Extension; |
+28
-13
@@ -320,18 +320,32 @@ import { Decoration, showPanel, EditorView, ViewPlugin, gutter, showTooltip, hoverTooltip, getPanel, logException, WidgetType, GutterMarker } from '@codemirror/view'; | ||
| combine(input) { | ||
| return Object.assign({ sources: input.map(i => i.source).filter(x => x != null) }, combineConfig(input.map(i => i.config), { | ||
| delay: 750, | ||
| markerFilter: null, | ||
| tooltipFilter: null, | ||
| needsRefresh: null, | ||
| hideOn: () => null, | ||
| }, { | ||
| needsRefresh: (a, b) => !a ? b : !b ? a : u => a(u) || b(u) | ||
| })); | ||
| return { | ||
| sources: input.map(i => i.source).filter(x => x != null), | ||
| ...combineConfig(input.map(i => i.config), { | ||
| delay: 750, | ||
| markerFilter: null, | ||
| tooltipFilter: null, | ||
| needsRefresh: null, | ||
| hideOn: () => null, | ||
| }, { | ||
| delay: Math.max, | ||
| markerFilter: combineFilter, | ||
| tooltipFilter: combineFilter, | ||
| needsRefresh: (a, b) => !a ? b : !b ? a : u => a(u) || b(u), | ||
| hideOn: (a, b) => !a ? b : !b ? a : (t, x, y) => a(t, x, y) || b(t, x, y), | ||
| autoPanel: (a, b) => a || b | ||
| }) | ||
| }; | ||
| } | ||
| }); | ||
| function combineFilter(a, b) { | ||
| return !a ? b : !b ? a : (d, s) => b(a(d, s), s); | ||
| } | ||
| /** | ||
| Given a diagnostic source, this function returns an extension that | ||
| enables linting with that source. It will be called whenever the | ||
| editor is idle (after its content changed). If `null` is given as | ||
| source, this only configures the lint extension. | ||
| editor is idle (after its content changed). | ||
| Note that settings given here will apply to all linters active in | ||
| the editor. If `null` is given as source, this only configures the | ||
| lint extension. | ||
| */ | ||
@@ -386,5 +400,6 @@ function linter(source, config = {}) { | ||
| name.slice(keyIndex + 1)]; | ||
| let markClass = action.markClass ? " " + action.markClass : ""; | ||
| return elt("button", { | ||
| type: "button", | ||
| class: "cm-diagnosticAction", | ||
| class: "cm-diagnosticAction" + markClass, | ||
| onclick: click, | ||
@@ -812,3 +827,3 @@ onmousedown: click, | ||
| if (tooltip && tr.docChanged) | ||
| tooltip = hideTooltip(tr, tooltip) ? null : Object.assign(Object.assign({}, tooltip), { pos: tr.changes.mapPos(tooltip.pos) }); | ||
| tooltip = hideTooltip(tr, tooltip) ? null : { ...tooltip, pos: tr.changes.mapPos(tooltip.pos) }; | ||
| return tr.effects.reduce((t, e) => e.is(setLintGutterTooltip) ? e.value : t, tooltip); | ||
@@ -815,0 +830,0 @@ }, |
+1
-1
| { | ||
| "name": "@codemirror/lint", | ||
| "version": "6.8.5", | ||
| "version": "6.9.0", | ||
| "description": "Linting support for the CodeMirror code editor", | ||
@@ -5,0 +5,0 @@ "scripts": { |
93166
1.79%2015
1.72%