代码编辑器语言支持
语言支持指片段编辑器根据文件扩展名(如 .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 | 对应语言 |
.ps1, .psm1 | powershell | PowerShell |
.txt | plaintext | 纯文本 |
按运行环境识别
| 环境变量 | 语言 | 说明 |
|---|---|---|
plain | plaintext | 纯文本 |
rich | markdown | Markdown |
shell | shell | Shell 脚本 |
applescript | applescript | AppleScript |
js | javascript | JavaScript |
powershell | powershell | PowerShell(执行);高亮优先看 .ps1 文件名 |
python | python | Python |
内置高亮
片段代码编辑器支持高亮。内置语言包括:plaintext、javascript、typescript、json、html、css、scss、less、markdown、xml、yaml、sql、python、java、c、cpp、csharp、go、rust、php、ruby、swift、kotlin、lua、r、shell、powershell、assembly、objective-c 以及 clojure / dart / haskell / scala 等(完整列表见应用内设置 → 编辑器语言选项)。设置里还可注册自定义语言。
具体以当前版本为准。
最后更新于