配置 Code Runner 实现快速编译运行 Cangjie 程序
AI 摘要
文章介绍在 VSCode 中安装 Code Runner 插件后,通过修改 settings.json,为 .cj 文件添加编译运行命令,实现一键编译执行 Cangjie 程序;分别给出 Windows+WSL 与 VMware+Deepin/Ubuntu 两种环境的配置示例。
Windows + WSL + Ubuntu20.4
在 VSCode 插件市场中搜索 Code Runner 并安装。
配置 Code Runner 插件。
在 settings.json 写入以下配置。
"code-runner.runInTerminal": true,
"terminal.integrated.profiles.windows": {
"wsl": {
"path": "C:\\Windows\\System32\\wsl.exe"
}
},
"terminal.integrated.defaultProfile.windows": "wsl",
"code-runner.terminalRoot": "/mnt/",
"code-runner.executorMapByFileExtension": {
".cj": "cd $dir && cjc $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt",
}使用 Code Runner 编译并运行。
VMware + Deepin/Ubuntu
在 VSCode 插件市场中搜索 Code Runner 并安装,配置 Code Runner 插件,并在 settings.json 写入以下配置。
"code-runner.executorMapByFileExtension": {
".cj": "cd $dir && cjc $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt",
}使用 Code Runner 编译并运行。