使用 VMware + Deepin 快速体验 Cangjie 0.26.2
AI 摘要
安装 Deepin20.4
下载 Deepin20.4 镜像:https://www.deepin.org/zh/download/
使用 VMWare 新建虚拟机,典型安装即可。
设置虚拟机 CD/DVD,加载 Deepin20.4 系统镜像。
启动虚拟机,按步骤提示安装 Deepin20.4 操作系统。
配置 Cangjie 运行环境
系统安装完成后,进入桌面,打开终端窗口,并依次执行以下命令切换源。此过程耗时较长,请耐心等待。
sudo sed -i s@/archive.ubuntu.com/@/mirrors.aliyun.com/@g /etc/apt/sources.list
sudo apt-get update
sudo apt full-upgrade -y
sudo apt autoremove安装 build-essential。
sudo apt-get install build-essential安装 libgcc-7-dev。
sudo apt-get install libgcc-7-dev安装 libtinfo.so.5。
sudo apt install libncurses5安装 binutils。
sudo apt-get install binutils建立软连接。
sudo ln -s /usr/lib/x86_64-linux-gnu/libstdc++.so.6 /usr/lib/libstdc++.so获取 Cangjie_0.26.2-ubuntu_18.04-x86_64.tar.gz,并将文件上传到虚拟机内并解压。
cangjie 运行环境的路径为:/home/duozai/Desktop/Cangjie/Cangjie_0.26.2-ubuntu_18.04-x86_64/cangjie。
修改 envsetup.sh 文件,将 cangjie 运行环境的路径赋值给 current_dir。
修改 home 主目录下的 .bashrc 文件(此文件为隐藏文件),将以下内容追加到文件末尾。
export current_dir=自行替换cangjie运行环境的路径
export PATH=${current_dir}/bin:$PATH
export LIBRARY_PATH=${current_dir}/lib/linux_x86_64_llvm:${LIBRARY_PATH}
export LD_LIBRARY_PATH=${current_dir}/lib/linux_x86_64_llvm:${LD_LIBRARY_PATH}
export CANGJIE_HOME=${current_dir}打开终端,依次执行以下命令,检测运行环境是否配置成功。
cjc -v
cpm -v配置 VSCode
打开 Deepin 应用商店,安装 VSCode。
获取 Cangjie_VSCode_0.26.2-ubuntu18.04-x86_64.tar.gz,并将文件上传到虚拟机内并解压。
VSCode 插件目录地址为:/home/duozai/Desktop/Cangjie/Cangjie_VSCode_0.26.2-ubuntu18.04-x86_64。
打开 VSCode,安装 Cangjie-lsp-0.26.2.vsix 插件。
配置 VSCode 插件,设置 LSPServer 服务端路径。
LSPServer 服务端路径为:VSCode 插件目录地址/LSPServer,如:/home/duozai/Desktop/Cangjie/Cangjie_VSCode_0.26.2-ubuntu18.04-x86_64/LSPServer。
Hello Cangjie
打开 VSCode,创建目录及文件:cangjie_helloworld/src/helloworld.cj。
编写 helloworld.cj 代码:
func main() {
println("hello world,hello Cangjie")
}打开终端,执行命令,并查看输出结果。
cjc src/helloworld.cj
./main