Socket
Socket
Sign inDemoInstall

@codemirror/lint

Package Overview
Dependencies
Maintainers
2
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@codemirror/lint - npm Package Compare versions

Comparing version 0.18.1 to 0.18.2

10

CHANGELOG.md

@@ -0,1 +1,11 @@

## 0.18.2 (2021-04-16)
### Bug fixes
Newlines in line messages are now shown as line breaks to the user.
### New features
You can now pass a delay option to `linter` to configure how long it waits before calling the linter.
## 0.18.1 (2021-03-15)

@@ -2,0 +12,0 @@

10

dist/index.d.ts

@@ -54,3 +54,3 @@ import { EditorView, Command, KeyBinding } from '@codemirror/view';

/**
State effect that is used to update the current set of
Returns a transaction spec which updates the current set of
diagnostics.

@@ -83,4 +83,10 @@ */

*/
declare function linter(source: (view: EditorView) => readonly Diagnostic[] | Promise<readonly Diagnostic[]>): Extension;
declare function linter(source: (view: EditorView) => readonly Diagnostic[] | Promise<readonly Diagnostic[]>, config?: {
/**
Time to wait (in milliseconds) after a change before running
the linter. Defaults to 750ms.
*/
delay?: number;
}): Extension;
export { Action, Diagnostic, closeLintPanel, lintKeymap, linter, nextDiagnostic, openLintPanel, setDiagnostics };

41

dist/index.js

@@ -45,3 +45,3 @@ import { EditorView, Decoration, ViewPlugin, logException, WidgetType } from '@codemirror/view';

/**
State effect that is used to update the current set of
Returns a transaction spec which updates the current set of
diagnostics.

@@ -54,6 +54,6 @@ */

}
const setDiagnosticsEffect = StateEffect.define();
const togglePanel = StateEffect.define();
const movePanelSelection = StateEffect.define();
const lintState = StateField.define({
const setDiagnosticsEffect = /*@__PURE__*/StateEffect.define();
const togglePanel = /*@__PURE__*/StateEffect.define();
const movePanelSelection = /*@__PURE__*/StateEffect.define();
const lintState = /*@__PURE__*/StateField.define({
create() {

@@ -98,3 +98,3 @@ return new LintState(Decoration.none, null, null);

});
const activeMark = Decoration.mark({ class: "cm-lintRange cm-lintRange-active" });
const activeMark = /*@__PURE__*/Decoration.mark({ class: "cm-lintRange cm-lintRange-active" });
function lintTooltip(view, pos, side) {

@@ -170,3 +170,2 @@ let { diagnostics } = view.state.field(lintState);

];
const LintDelay = 500;
/**

@@ -177,10 +176,12 @@ Given a diagnostic source, this function returns an extension that

*/
function linter(source) {
function linter(source, config = {}) {
var _a;
let delay = (_a = config.delay) !== null && _a !== void 0 ? _a : 750;
return ViewPlugin.fromClass(class {
constructor(view) {
this.view = view;
this.lintTime = Date.now() + LintDelay;
this.lintTime = Date.now() + delay;
this.set = true;
this.run = this.run.bind(this);
setTimeout(this.run, LintDelay);
setTimeout(this.run, delay);
}

@@ -205,6 +206,6 @@ run() {

if (update.docChanged) {
this.lintTime = Date.now() + LintDelay;
this.lintTime = Date.now() + delay;
if (!this.set) {
this.set = true;
setTimeout(this.run, LintDelay);
setTimeout(this.run, delay);
}

@@ -421,7 +422,2 @@ }

rm();
if (!this.list.firstChild)
this.list.appendChild(renderDiagnostic(this.view, {
severity: "info",
message: this.view.state.phrase("No diagnostics")
}, true));
}

@@ -451,7 +447,8 @@ moveSelection(selectedIndex) {

}
const baseTheme = EditorView.baseTheme({
const baseTheme = /*@__PURE__*/EditorView.baseTheme({
".cm-diagnostic": {
padding: "3px 6px 3px 8px",
marginLeft: "-1px",
display: "block"
display: "block",
whiteSpace: "pre-wrap"
},

@@ -478,5 +475,5 @@ ".cm-diagnostic-error": { borderLeft: "5px solid #d11" },

},
".cm-lintRange-error": { backgroundImage: underline("#d11") },
".cm-lintRange-warning": { backgroundImage: underline("orange") },
".cm-lintRange-info": { backgroundImage: underline("#999") },
".cm-lintRange-error": { backgroundImage: /*@__PURE__*/underline("#d11") },
".cm-lintRange-warning": { backgroundImage: /*@__PURE__*/underline("orange") },
".cm-lintRange-info": { backgroundImage: /*@__PURE__*/underline("#999") },
".cm-lintRange-active": { backgroundColor: "#ffdd9980" },

@@ -483,0 +480,0 @@ ".cm-lintPoint": {

{
"name": "@codemirror/lint",
"version": "0.18.1",
"version": "0.18.2",
"description": "Linting support for the CodeMirror code editor",

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

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc