刚建了一个QQ群,欢迎加入一起交流学习 (群号: 746153004)
这是一个基于Volar开发的ArkTS VSCode扩展。🌹为似乎到现在还没有支持VSCode,现有的VSCode市场中的ArkTS扩展大都非常简陋,所以决定自己写一个。
- 🌹 1.x版本开始具备完整的
ArkTS语言支持,全量支持所有ArkTS语法。 - 🎨 内置文件图标主题:提供
ArkTS Icons主题,支持ArkTS文件类型(.ets、.json5等)和常见Web项目文件(JavaScript、React、CSS、Markdown等),适用于Nx monorepo等混合项目。 - 🖊️ 完善的JSON Schema支持。支持以下文件的JSON Schema:
build-profile.json5模块级别/项目级别配置oh-package.json5模块级别/项目级别配置module.json5模块级别/项目级别配置code-linter.json5模块级别/项目级别配置resources/element/下所有的color.json、string.json等的kv值配置main_pages.json5配置AppScope/app.json5配置
- 📦 1.x版本开始支持安装和管理
OpenHarmony SDK,并且支持根据当前打开的项目自动探测API版本,发出弹窗提示下载或切换 - 🥇 1.1.6+ 版本开始支持完美的
$r函数补全和跳转、支持module.json5文件的补全和跳转、resources/element/下所有json文件点击查询全局引用;由 @arkts/project-detector hvigor项目分析器提供强力支撑 ✊ - 🍞 1.1.8+ 版本开始支持
module.json5文件路径补全和跳转、引用表达式错误诊断、requestPermissions权限补全等一系列 new feature ✨
- Marketplace安装: https://marketplace.visualstudio.com/items?itemName=NailyZero.vscode-naily-ets
- Open VSX安装:https://open-vsx.org/extension/NailyZero/vscode-naily-ets
或者直接在VSCode中搜索ArkTS Support即可。
详情请见 Arkcode 组织文档。
本扩展内置了ArkTS Icons文件图标主题,提供对ArkTS和Web开发文件的完整支持:
支持的文件类型:
- ArkTS文件:
.ets、.hml、.json5配置文件 - Web开发:JavaScript (
.js、.jsx)、TypeScript (.ts、.tsx)、React - 样式文件:CSS、SCSS、SASS、LESS、HTML
- 文档:Markdown (
.md、.mdx)、文本文件 - 配置文件:
.gitignore、.env、.eslintrc、package.json、next.config.js等 - 常见文件夹:
node_modules、src、components、pages、app等
启用方式:
- 打开命令面板 (
Cmd+Shift+P/Ctrl+Shift+P) - 输入 "Preferences: File Icon Theme"
- 选择 "ArkTS Icons"
或在 settings.json 中设置:
{
"workbench.iconTheme": "arkts-icons"
}📖 详细文档:ArkTS 文件图标主题完整指南
也可以使用Material Icon Theme,我已经给Material Icon Theme提交了PR,目前将.ets、.d.ets直接用上了TypeScript官方的文件图标包,升级到v5.22.0之后的版本都可用 👇
PR地址: material-extensions/vscode-material-icon-theme#2966
| Key | Description | Type | Default | Example |
|---|---|---|---|---|
ets.sdkPath |
%configuration.ets.sdkPath.description% | string |
"" |
${os.homedir}/AppData/Local/OpenHarmony/20 |
ets.baseSdkPath |
%configuration.ets.baseSdkPath.description% | string |
"${os.homedir}/OpenHarmony" |
"${os.homedir}/AppData/Local/OpenHarmony" |
ets.hmsPath |
%configuration.ets.hmsPath.description% | string |
"" |
|
ets.lspDebugMode |
%configuration.ets.lspDebugMode.description% | boolean |
false |
true |
ets.hdcPath |
%configuration.ets.hdcPath.description% | string |
"" |
|
ets.sdkList |
A list of installed OpenHarmony SDK paths. Keys should follow the pattern API[number] (e.g., API9, API10). | object |
{} |
{"API20": "${os.homedir}/OpenHarmony/20", "API18": "/opt/OpenHarmony/18"} |
| Command | Title |
|---|---|
ets.restartServer |
ETS: %command.restartServer% |
ets.installSDK |
ETS: %command.installSDK% |
ArkTs-X 组织有维护一个官方的跨平台arkts项目构建管理cli,可用于build和烧录
可以参考以下链接进行安装
参考使用方式:
ohos@user Desktop % ace create demo
? Enter the project name(demo): # 输入工程名称,不输入默认为文件夹名称
? Enter the bundleName (com.example.demo): # 输入包名,不输入默认为com.example.工程名
? Enter the runtimeOS (1: OpenHarmony, 2: HarmonyOS): 1 # 输入RuntimeOS系统
? Please select the Complie SDK (1: 10, 2: 11, 3: 12): 2 # 输入编译SDK版本
Signing iOS app for device deployment using developer identity: "Apple Development: xxxxx"
Project created. Target directory: ${当前目录}/demo.
In order to run your app, type:
$ cd demo
$ ace run
Your app code is in demo/entry.如果觉得这个项目对你有帮助,可以请作者喝杯咖啡 ☕️
也可以加入QQ群,一起交流学习 (群号: 746153004)
