Closed kezhongfa closed 6 months ago
are you using the "simple" or "custom" approach?
are you using the "simple" or "custom" approach?
simple. I'm just giving an example. The console shouldn't report errors, it has to show the user the error message and know how to change it.
Encountered it too. Filtering out diagnostics with from
and to
properties that equals undefined
seems to solve the problem.
import { jsonParseLinter } from '@codemirror/lang-json';
import { jsonSchemaLinter } from 'codemirror-json-schema';
const lintJson = jsonParseLinter();
const lintJsonSchema = jsonSchemaLinter();
export function customJsonLinter() {
return (view: EditorView) => {
const parseErrors = lintJson(view);
const schemaErrors = lintJsonSchema(view).filter(
(diagnostic) => diagnostic.from !== undefined && diagnostic.to !== undefined
);
return [...schemaErrors, ...parseErrors];
};
}
good catch, this is a recently introduced regression (from fixing required property validation) that we don't test for yet!
after closer debugging, it's related to the introduction of new error types in our dependency which handles validation. I have a branch that should fix this!
Phenomenon: official website demo must appear.
Reproduction step: add "," to any value.
Desired: error message syntax highlighting.
![image](https://github.com/acao/codemirror-json-schema/assets/6939549/42d1bf88-2bf8-4956-90bc-6063aa81467b)