简体   繁体   English

如何在摩纳哥编辑器的 html 语言中为代码完成添加自定义标记和属性?

[英]How to add custom tag and attributes for code completions in html language of monaco editor?

I need to provide a list of web components in the code completions of the monaco editor, I tried writing snippets but those snippets are not getting triggered if i start with '<'我需要在 monaco 编辑器的代码完成中提供 web 组件列表,我尝试编写代码片段,但如果我以“<”开头,这些代码片段不会被触发

I am not sure if there is a ready-to-use solution, I've tried to approach "the hard way" by using XSD (a schema file for defining the syntax and then parsing it).我不确定是否有现成的解决方案,我试图通过使用 XSD(用于定义语法然后解析它的模式文件)来接近“艰难的方式”。 Unfortunately for XML completion the schema direct support is not there as far as I know (please correct me if I am wrong).不幸的是,对于 XML 完成,据我所知,模式直接支持不存在(如果我错了,请纠正我)。 So puzzled with the same question I've start with custom auto-completion provider.我从自定义自动完成提供程序开始对同样的问题感到困惑。

Here is an article that helped me a lot.这是一篇对我帮助很大的文章。 https://mono.software/2017/04/11/custom-intellisense-with-monaco-editor/ https://mono.software/2017/04/11/custom-intellisense-with-monaco-editor/

This is the matching repository: https://github.com/isimic413/monaco-editor-custom-intellisense/tree/master/sample-editor这是匹配的存储库: https://github.com/isimic413/monaco-editor-custom-intellisense/tree/master/sample-editor

Please note that it's not updated to the latest version of the API;请注意,它没有更新到最新版本的 API; you may need to make some code corrections to make it work.您可能需要进行一些代码更正才能使其正常工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM