如何正确使用Monaco作为JS代码编译器?

更新于
2026-09-26 13:12:34
0阅读来源:SEO资讯
  • 内容介绍
  • 文章标签
  • 相关推荐

本文共计657个文字,预计阅读时间需要3分钟。

如何正确使用Monaco作为JS代码编译器?

前言+我的需求是可以语法高亮、函数提示、自动换行、代码折叠+Monaco+Monaco是微软家的,支持的语种很多,还有缩略地图,有时候提示不好用然后体积很大。+The Monaco Editor is the c#“

前言

我的需求是可以语法高亮、函数提示功能、自动换行、代码折叠

Monaco

Monaco是微软家的,支持的语言很多,还有缩略地图,有时候提示不好用然后包体很大。
The Monaco Editor is the code editor that powers VS Code.

使用方法官网

[官方文档](microsoft.github.io/monaco-editor/index.html)
[在线demo](github.com/Microsoft/monaco-editor-samples)
[github](github.com/Microsoft/monaco-editor)

安装

yarn add monaco-editor | npm install monaco-editor

引入

import * as monaco from 'monaco-editor' // 包体很大了 但是demo可以跑起来 //自定义一些提示函数 const suggestions = [ { label: 'split_chinese', insertText: 'split_chinese(inputString,language);', // 不写的时候不展示。。

阅读全文
标签:需

本文共计657个文字,预计阅读时间需要3分钟。

如何正确使用Monaco作为JS代码编译器?

前言+我的需求是可以语法高亮、函数提示、自动换行、代码折叠+Monaco+Monaco是微软家的,支持的语种很多,还有缩略地图,有时候提示不好用然后体积很大。+The Monaco Editor is the c#“

前言

我的需求是可以语法高亮、函数提示功能、自动换行、代码折叠

Monaco

Monaco是微软家的,支持的语言很多,还有缩略地图,有时候提示不好用然后包体很大。
The Monaco Editor is the code editor that powers VS Code.

使用方法官网

[官方文档](microsoft.github.io/monaco-editor/index.html)
[在线demo](github.com/Microsoft/monaco-editor-samples)
[github](github.com/Microsoft/monaco-editor)

安装

yarn add monaco-editor | npm install monaco-editor

引入

import * as monaco from 'monaco-editor' // 包体很大了 但是demo可以跑起来 //自定义一些提示函数 const suggestions = [ { label: 'split_chinese', insertText: 'split_chinese(inputString,language);', // 不写的时候不展示。。

阅读全文
标签:需