@codemirror/lint 6.6.0 → 6.7.1

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 CHANGED
@@ -1,3 +1,15 @@
1
+ ## 6.7.1 (2024-05-15)
2
+
3
+ ### Bug fixes
4
+
5
+ Don't perform an additional superfluous timed lint run after `forceLinting` has been called.
6
+
7
+ ## 6.7.0 (2024-04-30)
8
+
9
+ ### New features
10
+
11
+ The `renderMessage` function is now called with the editor view as first argument.
12
+
1
13
  ## 6.6.0 (2024-04-29)
2
14
 
3
15
  ### New features
package/dist/index.cjs CHANGED
@@ -225,6 +225,7 @@ const lintPlugin = view.ViewPlugin.fromClass(class {
225
225
  this.timeout = setTimeout(this.run, delay);
226
226
  }
227
227
  run() {
228
+ clearTimeout(this.timeout);
228
229
  let now = Date.now();
229
230
  if (now < this.lintTime - 10) {
230
231
  this.timeout = setTimeout(this.run, this.lintTime - now);
@@ -314,7 +315,7 @@ function assignKeys(actions) {
314
315
  function renderDiagnostic(view, diagnostic, inPanel) {
315
316
  var _a;
316
317
  let keys = inPanel ? assignKeys(diagnostic.actions) : [];
317
- return elt("li", { class: "cm-diagnostic cm-diagnostic-" + diagnostic.severity }, elt("span", { class: "cm-diagnosticText" }, diagnostic.renderMessage ? diagnostic.renderMessage() : diagnostic.message), (_a = diagnostic.actions) === null || _a === void 0 ? void 0 : _a.map((action, i) => {
318
+ return elt("li", { class: "cm-diagnostic cm-diagnostic-" + diagnostic.severity }, elt("span", { class: "cm-diagnosticText" }, diagnostic.renderMessage ? diagnostic.renderMessage(view) : diagnostic.message), (_a = diagnostic.actions) === null || _a === void 0 ? void 0 : _a.map((action, i) => {
318
319
  let fired = false, click = (e) => {
319
320
  e.preventDefault();
320
321
  if (fired)
package/dist/index.d.cts CHANGED
@@ -40,7 +40,7 @@ interface Diagnostic {
40
40
  An optional custom rendering function that displays the message
41
41
  as a DOM node.
42
42
  */
43
- renderMessage?: () => Node;
43
+ renderMessage?: (view: EditorView) => Node;
44
44
  /**
45
45
  An optional array of actions that can be taken on this
46
46
  diagnostic.
package/dist/index.d.ts CHANGED
@@ -40,7 +40,7 @@ interface Diagnostic {
40
40
  An optional custom rendering function that displays the message
41
41
  as a DOM node.
42
42
  */
43
- renderMessage?: () => Node;
43
+ renderMessage?: (view: EditorView) => Node;
44
44
  /**
45
45
  An optional array of actions that can be taken on this
46
46
  diagnostic.
package/dist/index.js CHANGED
@@ -223,6 +223,7 @@ const lintPlugin = /*@__PURE__*/ViewPlugin.fromClass(class {
223
223
  this.timeout = setTimeout(this.run, delay);
224
224
  }
225
225
  run() {
226
+ clearTimeout(this.timeout);
226
227
  let now = Date.now();
227
228
  if (now < this.lintTime - 10) {
228
229
  this.timeout = setTimeout(this.run, this.lintTime - now);
@@ -312,7 +313,7 @@ function assignKeys(actions) {
312
313
  function renderDiagnostic(view, diagnostic, inPanel) {
313
314
  var _a;
314
315
  let keys = inPanel ? assignKeys(diagnostic.actions) : [];
315
- return elt("li", { class: "cm-diagnostic cm-diagnostic-" + diagnostic.severity }, elt("span", { class: "cm-diagnosticText" }, diagnostic.renderMessage ? diagnostic.renderMessage() : diagnostic.message), (_a = diagnostic.actions) === null || _a === void 0 ? void 0 : _a.map((action, i) => {
316
+ return elt("li", { class: "cm-diagnostic cm-diagnostic-" + diagnostic.severity }, elt("span", { class: "cm-diagnosticText" }, diagnostic.renderMessage ? diagnostic.renderMessage(view) : diagnostic.message), (_a = diagnostic.actions) === null || _a === void 0 ? void 0 : _a.map((action, i) => {
316
317
  let fired = false, click = (e) => {
317
318
  e.preventDefault();
318
319
  if (fired)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codemirror/lint",
3
- "version": "6.6.0",
3
+ "version": "6.7.1",
4
4
  "description": "Linting support for the CodeMirror code editor",
5
5
  "scripts": {
6
6
  "test": "cm-runtests",