Skip to content

Commit

Permalink
Manually add linting annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
mbasaglia committed Jun 30, 2022
1 parent 3ddbbc9 commit 147bfe1
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
4 changes: 2 additions & 2 deletions codemirror/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -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";


Expand All @@ -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(" ")
Expand Down
7 changes: 6 additions & 1 deletion docs/playground/json_editor.md
Original file line number Diff line number Diff line change
Expand Up @@ -708,7 +708,6 @@ body.wide .container {
return [
this.decoration_field,
this.info_box_field,
CodeMirrorWrapper.linter((() => this.lint_errors).bind(this))
]
}

Expand All @@ -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})]});
}
Expand Down
3 changes: 2 additions & 1 deletion docs/scripts/editor.bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(" ")
Expand Down Expand Up @@ -23806,6 +23806,7 @@
exports.linter = linter;
exports.on_change = on_change;
exports.redo = redo;
exports.setDiagnostics = setDiagnostics;
exports.showTooltip = showTooltip;
exports.undo = undo;

Expand Down

0 comments on commit 147bfe1

Please sign in to comment.