Hi, i’m trying to use SQL dialects but it seems that the parsers (all the dialects) NEVER set isError to true when i write something like
Select *; foo;
This is a clear syntax error in every SQL dialects but the NodeType inside the enter() never has isError to true.
How do i know if the parsing failed?
this is my usage:
(value is a state variable inside a react component, it has the right content)
function lintExample(view: EditorView): readonly Diagnostic[] {
const diagnostics: Diagnostic[] = [];
try{
<SQLDialect>.language.parser.configure({strict: true}).parse(value).iterate({
enter: (type, from, to) => {
if (type.isError) {
diagnostics.push({
from,
to,
severity: "error",
message: ""+type.isError,
});
}
},
});
}catch (e){
diagnostics.push({
from: 0,
to: value.length,
severity: "error",
message: "CRITICAL ERROR"
})
}
return diagnostics;
}
“”+type.isError is only for debug purpose