gpt4 book ai didi

javascript - Codemirror- linting - 是否有明确触发 linting 的事件?

转载 作者:搜寻专家 更新时间:2023-11-01 04:51:54 30 4
gpt4 key购买 nike

我正在使用工具栏附带的 CodeMirror 设计一个应用程序。由于性能原因,我没有通过异步或异步模式执行 lint。

我在工具栏中提供了一个图标,单击它我正在解析和构建错误。但是我对如何在编辑器中更新 lint 错误感到困惑?

任何指针都会非常有帮助。

最佳答案

lint 插件为所有编辑器实例添加了一个“扩展”方法,称为 performLint,结合 lint: { lintOnChange: false } 的编辑器选项,然后您可以通过调用 mirror.performLint() 调用 linter。

如果您定义自己的 lint 方法 ala

CodeMirror.registerHelper('lint', 'mode', (text) => { /* your cool stuff here */ })

这将在 performLint() 上被调用。

关于javascript - Codemirror- linting - 是否有明确触发 linting 的事件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24568105/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com