Socket
Socket
Sign inDemoInstall

@codemirror/lint

Package Overview
Dependencies
3
Maintainers
2
Versions
36
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 6.2.2 to 6.3.0

6

CHANGELOG.md

@@ -0,1 +1,7 @@

## 6.3.0 (2023-06-23)
### New features
A new `previousDiagnostic` command can be used to move back through the active diagnostics.
## 6.2.2 (2023-06-05)

@@ -2,0 +8,0 @@

6

dist/index.d.ts

@@ -127,2 +127,6 @@ import * as _codemirror_state from '@codemirror/state';

/**
Move the selection to the previous diagnostic.
*/
declare const previousDiagnostic: Command;
/**
A set of default key bindings for the lint functionality.

@@ -164,2 +168,2 @@

export { Action, Diagnostic, LintSource, closeLintPanel, diagnosticCount, forEachDiagnostic, forceLinting, lintGutter, lintKeymap, linter, nextDiagnostic, openLintPanel, setDiagnostics, setDiagnosticsEffect };
export { Action, Diagnostic, LintSource, closeLintPanel, diagnosticCount, forEachDiagnostic, forceLinting, lintGutter, lintKeymap, linter, nextDiagnostic, openLintPanel, previousDiagnostic, setDiagnostics, setDiagnosticsEffect };

@@ -177,2 +177,26 @@ import { Decoration, showPanel, EditorView, ViewPlugin, logException, gutter, showTooltip, hoverTooltip, getPanel, WidgetType, GutterMarker } from '@codemirror/view';

/**
Move the selection to the previous diagnostic.
*/
const previousDiagnostic = (view) => {
let { state } = view, field = state.field(lintState, false);
if (!field)
return false;
let sel = state.selection.main;
let prevFrom, prevTo, lastFrom, lastTo;
field.diagnostics.between(0, state.doc.length, (from, to) => {
if (to < sel.to && (prevFrom == null || prevFrom < from)) {
prevFrom = from;
prevTo = to;
}
if (lastFrom == null || from > lastFrom) {
lastFrom = from;
lastTo = to;
}
});
if (lastFrom == null || prevFrom == null && lastFrom == sel.from)
return false;
view.dispatch({ selection: { anchor: prevFrom !== null && prevFrom !== void 0 ? prevFrom : lastFrom, head: prevTo !== null && prevTo !== void 0 ? prevTo : lastTo }, scrollIntoView: true });
return true;
};
/**
A set of default key bindings for the lint functionality.

@@ -759,2 +783,2 @@

export { closeLintPanel, diagnosticCount, forEachDiagnostic, forceLinting, lintGutter, lintKeymap, linter, nextDiagnostic, openLintPanel, setDiagnostics, setDiagnosticsEffect };
export { closeLintPanel, diagnosticCount, forEachDiagnostic, forceLinting, lintGutter, lintKeymap, linter, nextDiagnostic, openLintPanel, previousDiagnostic, setDiagnostics, setDiagnosticsEffect };

2

package.json
{
"name": "@codemirror/lint",
"version": "6.2.2",
"version": "6.3.0",
"description": "Linting support for the CodeMirror code editor",

@@ -5,0 +5,0 @@ "scripts": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc