diff --git a/codemirror/editor.js b/codemirror/editor.js index 8aec27cf..f800bcde 100644 --- a/codemirror/editor.js +++ b/codemirror/editor.js @@ -25,7 +25,7 @@ import { } from "@codemirror/language" export {ensureSyntaxTree, LanguageSupport} from "@codemirror/language" import {tags} from "@lezer/highlight" -export {linter, lintGutter, lintKeymap} from "@codemirror/lint"; +export {linter, lintGutter, lintKeymap, setDiagnostics} from "@codemirror/lint"; export {autocompletion, insertCompletionText} from "@codemirror/autocomplete"; @@ -38,7 +38,7 @@ const myHighlightStyle = HighlightStyle.define([ export const default_extensions = [ basicSetup, history(), - keymap.of([...defaultKeymap, ...historyKeymap, indentWithTab, {linux: "Mod-Shift-z" run: redo, preventDefault: true},]), + keymap.of([...defaultKeymap, ...historyKeymap, indentWithTab, {linux: "Mod-Shift-z", run: redo, preventDefault: true}]), syntaxHighlighting(defaultHighlightStyle), syntaxHighlighting(myHighlightStyle), indentUnit.of(" ") diff --git a/docs/playground/json_editor.md b/docs/playground/json_editor.md index fe872532..85624407 100644 --- a/docs/playground/json_editor.md +++ b/docs/playground/json_editor.md @@ -708,7 +708,6 @@ body.wide .container { return [ this.decoration_field, this.info_box_field, - CodeMirrorWrapper.linter((() => this.lint_errors).bind(this)) ] } @@ -733,6 +732,12 @@ body.wide .container { this.get_syntax_errors(tree); } + else + { + this.lint_errors = []; + } + + view.dispatch(CodeMirrorWrapper.setDiagnostics(view.state, this.lint_errors)); view.dispatch({effects: [this.load_info_effect.of({result: result})]}); } diff --git a/docs/scripts/editor.bundle.js b/docs/scripts/editor.bundle.js index 477de752..769c23d1 100644 --- a/docs/scripts/editor.bundle.js +++ b/docs/scripts/editor.bundle.js @@ -23770,7 +23770,7 @@ const default_extensions = [ basicSetup, history(), - keymap.of([...defaultKeymap, ...historyKeymap, indentWithTab]), + keymap.of([...defaultKeymap, ...historyKeymap, indentWithTab, {linux: "Mod-Shift-z", run: redo, preventDefault: true}]), syntaxHighlighting(defaultHighlightStyle), syntaxHighlighting(myHighlightStyle), indentUnit.of(" ") @@ -23806,6 +23806,7 @@ exports.linter = linter; exports.on_change = on_change; exports.redo = redo; + exports.setDiagnostics = setDiagnostics; exports.showTooltip = showTooltip; exports.undo = undo;