Cangjie development language, as a self-developed development language for HarmonyOS by Huawei, has only been released recently, but it shoulders an extremely important historical mission. As a developer of HarmonyOS, mastering the Cangjie development language will become an indispensable skill. Today, we start from scratch and share with you the development tutorial of the Cangjie language. What we are going to share today is setting up the development environment.
Cangjie provides development plugins in both DevEcoStudio and VSCode. As HarmonyOS developers, we may be more accustomed to using DevEcoStudio. So today, we will take DevEcoStudio as an example.
First, you need to download the Cangjie plugin. Pay attention to the matching versions of the Cangjie plugin and DevEco-studio. I suggest downloading the latest versions for all of them.
If you are unable to download, it might be because the Cangjie language is currently in the public testing stage. You need to sign up for the public test, and the review process is very fast.
After downloading DevEco-studio, click to install it. Keep the Cangjie plugin in place and do not extract it.
Open the Settings menu of DevEco-studio, select Plugins, find the Settings icon and click Install Plugin from Disk in the drop-down menu.
Select the Cangjie plugin you just downloaded. After the installation is completed, the corresponding plugin will appear in the left list. There will be a green "Restart IDE" button when the installation is completed for the first time. Click to restart.
After the restart is completed, the installation of the Cangjie plugin is also finished.
Try to create a new project. At this point, you will find that the relevant content of Cangjie has been newly added to the list:
These two projects respectively represent the pure Cangjie project and the Cangjie Mixed Development project. You can first create a pure Cangjie project to give it a try.
The directory structure and grammar of the Cangjie project are somewhat different from those of ArkTs, which is not the focus of today's attention. Cangjie also initialized a small Hello World demo for us.
@Entry
@Component
class EntryView {
@State
var message: String = "Hello Cangjie"
func build() {
Row {
Column {
Button(message).onClick {
evt => AppLog.info("Hello Cangjie");
}.fontSize(40).height(80)
}.width(100.percent)
}.height(100.percent)
}
}
This initialization code seems very similar to the code of ArkTs, but there are also some differences. The tutorial on the code will be introduced in detail in future articles. Now, just run it directly and give it a try. If you encounter a problem of running failure, you can try updating the version of the real device or the simulator.
The above is an introduction to the development environment for Cangjie language development. More content about Cangjie language will be shared in the future. Thank you for reading.
Top comments (0)