@mirascript/monaco 0.1.62-alpha.15 → 0.1.62-alpha.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +49 -0
- package/package.json +10 -5
package/README.md
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# @mirascript/monaco
|
|
2
|
+
|
|
3
|
+
`@mirascript/monaco` 为 Monaco Editor 提供 MiraScript 语言支持,包括语言注册、基础编辑体验以及基于语言服务的增强能力。
|
|
4
|
+
|
|
5
|
+
## 功能
|
|
6
|
+
|
|
7
|
+
- 注册 `mirascript` 与 `mirascript-template` 语言
|
|
8
|
+
- 基础语言特性,如高亮、括号匹配、简单编辑支持
|
|
9
|
+
- 可按需加载的 LSP 风格能力,如补全、诊断、跳转等
|
|
10
|
+
- 支持注入运行时上下文信息,增强编辑体验
|
|
11
|
+
|
|
12
|
+
## 安装
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
pnpm add @mirascript/monaco monaco-editor
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## 基本用法
|
|
19
|
+
|
|
20
|
+
```ts
|
|
21
|
+
import * as monaco from 'monaco-editor';
|
|
22
|
+
import { registerMiraScript } from '@mirascript/monaco';
|
|
23
|
+
|
|
24
|
+
registerMiraScript(monaco);
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
如果需要提供全局变量或上下文信息:
|
|
28
|
+
|
|
29
|
+
```ts
|
|
30
|
+
registerMiraScript(monaco, () => ({
|
|
31
|
+
globals: {
|
|
32
|
+
PI: 3.14159,
|
|
33
|
+
},
|
|
34
|
+
}));
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## 模块入口
|
|
38
|
+
|
|
39
|
+
- `@mirascript/monaco`:默认入口,按需加载基础功能和 LSP 功能
|
|
40
|
+
- `@mirascript/monaco/basic`:仅基础语言支持
|
|
41
|
+
- `@mirascript/monaco/lsp`:LSP 相关能力
|
|
42
|
+
|
|
43
|
+
## 开发
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
pnpm --filter @mirascript/monaco build
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
该包通常与 `@mirascript/mirascript`、`@mirascript/help` 和 `@mirascript/constants` 一起使用。
|
package/package.json
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mirascript/monaco",
|
|
3
|
-
"version": "0.1.62-alpha.
|
|
3
|
+
"version": "0.1.62-alpha.21",
|
|
4
4
|
"author": "CloudPSS",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "Monaco Editor integration for Mirascript.",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/CloudPSS/MiraScript.git",
|
|
10
|
+
"directory": "packages/monaco"
|
|
11
|
+
},
|
|
7
12
|
"type": "module",
|
|
8
13
|
"main": "./dist/index.js",
|
|
9
14
|
"types": "./dist/index.d.ts",
|
|
@@ -28,10 +33,10 @@
|
|
|
28
33
|
}
|
|
29
34
|
},
|
|
30
35
|
"dependencies": {
|
|
31
|
-
"@mirascript/bindings": "~0.1.62-alpha.
|
|
32
|
-
"@mirascript/
|
|
33
|
-
"@mirascript/
|
|
34
|
-
"@mirascript/mirascript": "~0.1.62-alpha.
|
|
36
|
+
"@mirascript/bindings": "~0.1.62-alpha.21",
|
|
37
|
+
"@mirascript/constants": "~0.1.62-alpha.21",
|
|
38
|
+
"@mirascript/help": "~0.1.62-alpha.21",
|
|
39
|
+
"@mirascript/mirascript": "~0.1.62-alpha.21"
|
|
35
40
|
},
|
|
36
41
|
"peerDependencies": {
|
|
37
42
|
"monaco-editor": ">= 0.0.40"
|