摩纳哥编辑器中自定义语言的语法验证 [英] Syntax validation of a custom language in Monaco editor
问题描述
我正在尝试将自定义语言集成到 monaco 编辑器中,并且我浏览了 https://microsoft.github.io/monaco-editor/monarch.html 了解语法高亮.
I'm trying to integrate a custom language to monaco editor and I went through https://microsoft.github.io/monaco-editor/monarch.html to get an idea on syntax highlighting.
但我找不到任何关于我们如何通过语法验证添加错误/警告验证的文档.在 Ace 编辑器中,我们通过编写一个 worker 并在其中执行验证功能来做到这一点.感谢有关此的任何链接/帮助.
But I couldn't find any doc on how we can add error/warning validations through syntax validation for this. In Ace editor we did this by writing a worker and performing validation function within it. Appreciate any links/help on this.
推荐答案
我最近成功完成了这件事,我只是使用了 monaco-css 作为样板,我现在唯一要做的就是为我的语言和我想要的其他功能编写一个解析器.这是我的代码.
I recently done this successfully i just used monaco-css as boiler-plate and the only thing that i have to do now is write a parser for my language and other features that I want in in it. and here is my code.
在项目根目录的 lang_services 文件夹中添加您的解析器和其他语言服务.
Add your parser and other language services in lang_services folder in root dir of project.
我认为这会有所帮助.
这篇关于摩纳哥编辑器中自定义语言的语法验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!