简体   繁体   English

如何在 Monaco Editor 中添加 angular 特定代码

[英]How to add angular specific code in Monaco Editor

I am using Monaco editor to build my browser based IDE.我正在使用 Monaco 编辑器构建基于浏览器的 IDE。 In that, I want the user to write his Angular specific code eg:在那,我希望用户编写他的 Angular 特定代码,例如:

import { Component } from '@angular/core';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.scss']
})
export class AppComponent {}

Right now Monaco editor shows syntax error.现在摩纳哥编辑器显示语法错误。 How to enable this feature in Monaco editor.如何在 Monaco 编辑器中启用此功能。

Monaco comes with a number of supported languages. Monaco 附带了许多受支持的语言。 Four of them (CSS, HTML, JSON, Typescript/Javascript) have full implementations (code completion etc.).其中四个(CSS、HTML、JSON、Typescript/Javascript)具有完整的实现(代码完成等)。 More than 70 others at least have syntax highlighting support (C++, C#, Dart, Docker, Lua, to name a few). More than 70 others at least have syntax highlighting support (C++, C#, Dart, Docker, Lua, to name a few).

Angular, however, is not among them, so you would have to write your own language support.然而,Angular 不在其中,因此您必须编写自己的语言支持。 Start by copying an existing contribution folder and modify the syntax rules for Angular.首先复制现有的贡献文件夹并修改 Angular 的语法规则。 Later you can continue with things like validation and code completion.稍后您可以继续进行验证和代码完成等工作。

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

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