check problem
sxw66 opened this issue · comments
Describe the bug
I want to add check check error, when I add useWorker: true in options, it does not work, must import ace from "ace-builds"; Then set ace.config.setModuleURL ("ace/mode/json_worker", workerJsonUrl);
Because I use VUE3 + TS syntax, when I set setModuleUrl, it reported a type error, so I need to add a global.d.ts to solve this problem, which is troublesome. The verification problem must be handled inside the package. Another problem is that I want to check if my input is correct when I lose focus, and this method like validate is not provided for me, so I have to take the write check myself which is not reasonable
Expected Behavior
Expected result If you want to fix this check method, just use options: configure useWorker: true to enable the check without me having to set it up again
ace.config.setModuleUrl("ace/mode/json_worker", workerJsonUrl); This is too much trouble. Hope we can fix this bug
My environment is VUE3 vite + ts, I don't know whether it is my configuration problem or the bug of the package, and I hope the author can add a verification method to it so that we don't need to judge when we lose focus in the local area
Current Behavior
Reproduction Steps
// 表格搜索参数-【body模式】-输入项改变事件
const onJsonBlur = (val, aaa) => {
// vue3-ace-editor
try {
JSON.parse(dataForm.textareashow);
ElMessage.success("JSON 格式正确");
emits(
"handeParmsFormData",
state.ParmsObjectData,
state.HeaderObjectData,
dataForm.textareashow
);
} catch (error) {
console.error("error", error);
const errorMessage = JSON 格式错误:${error.message}
;
ElMessage.error(errorMessage);
}
};
Possible Solution
No response
Additional Information/Context
No response
Ace Version / Browser / OS / Keyboard layout
"ace-builds": "^1.32.3",
Hey, thanks for your issue. If I read you correctly the main issue you're raising here is that types not being properly defined for setModuleUrl
.
Regarding the fetching of errors on losing focus, you can use editor.session.getAnnotations()
on losing focus to get all the errors/warnings collected by Ace.