代码编辑器语言支持
语言支持指片段编辑器根据文件扩展名(如 .py → Python)或片段的运行环境(如 shell、python)选择语法高亮与补全。以下为当前支持列表。
按文件扩展名识别
| 扩展名 | 语言 | 说明 |
|---|---|---|
.js, .jsx | javascript | JavaScript |
.ts, .tsx | typescript | TypeScript |
.py | python | Python |
.sh, .bash, .zsh | shell | Shell 脚本 |
.json | json | JSON |
.html, .htm | html | HTML |
.css | css | CSS |
.scss, .less | scss / less | SCSS / Less |
.md | markdown | Markdown |
.yaml, .yml | yaml | YAML |
.xml | xml | XML |
.sql | sql | SQL |
.go, .rs, .java, .kt, .swift | go / rust / java / kotlin / swift | 对应语言 |
.c, .h, .cpp, .hpp | c / cpp | C / C++ |
.php, .rb, .lua, .r | php / ruby / lua / r | 对应语言 |
.txt | plaintext | 纯文本 |
按运行环境识别
| 环境变量 | 语言 | 说明 |
|---|---|---|
plain | plaintext | 纯文本 |
rich | markdown | Markdown |
shell | shell | Shell 脚本 |
applescript | applescript | AppleScript |
js | javascript | JavaScript |
python | python | Python |
Monaco Editor 内置支持的语言
编辑器内核(Monaco)内置支持包括但不限于:
- 纯文本、JavaScript/TypeScript、JSON、HTML、CSS/SCSS/Less、Markdown、XML、YAML、SQL
- Python、Java、C/C++、C#、Go、Rust、PHP、Ruby、Swift、Kotlin、Lua、R
- Shell/Bash、PowerShell、Dockerfile、INI、Properties
- Perl、VB、CoffeeScript、F#、Clojure、Scala、Groovy、Objective-C、Handlebars、Razor 等
具体以应用内「设置 → 编辑器」及当前版本为准。若需新增扩展名或语言映射,请参考应用内帮助或联系支持。