集成开发环境
Wails 旨在提供出色的开发体验。 为此,我们现在支持生成 IDE 特定配置以提供更顺畅的项目设置。
目前,我们支持Visual Studio Code,但我们希望尽快支持其他 IDE,例如 Goland。
Visual Studio Code
使用-ide vscode
标志生成项目时,IDE 文件将与其他项目文件一起创建。 这些文件放置在.vscode
目录中,并为调试应用程序提供正确的配置。
生成的 2 个文件是tasks.json
和launch.json
. 以下是为默认 vanilla 项目生成的文件: 生成的 2 个文件是tasks.json
和launch.json
. 以下是为默认 vanilla 项目生成的文件: Below are the files generated for the default vanilla project: 生成的 2 个文件是tasks.json
和launch.json
. 以下是为默认 vanilla 项目生成的文件: Below are the files generated for the default vanilla project: 生成的 2 个文件是tasks.json
和launch.json
. 以下是为默认 vanilla 项目生成的文件: Below are the files generated for the default vanilla project: 生成的 2 个文件是tasks.json
和launch.json
. 以下是为默认 vanilla 项目生成的文件: Below are the files generated for the default vanilla project:
{
"version": "2.0.0",
"tasks": [
{
"label": "build",
"type": "shell",
"options": {
"cwd": "${workspaceFolder}"
},
"command": "go",
"args": ["build", "-tags", "dev", "-gcflags", "all=-N -l", "-o", "build/bin/myproject.exe"]
}
]
}
{
"version": "0.2.0",
"configurations": [
{
"name": "Wails: Debug myproject",
"type": "go",
"request": "launch",
"mode": "exec",
"program": "${workspaceFolder}/build/bin/myproject.exe",
"preLaunchTask": "build",
"cwd": "${workspaceFolder}",
"env": {},
"args": ["-assetdir", "frontend/src"]
}
]
}
配置安装和构建步骤
tasks.json
文件对于默认项目很简单,因为不需要npm install
或npm run build
的步骤。 对于具有前端构建步骤的项目,例如 svelte 模板,我们需要编辑tasks.json
以添加安装和构建步骤:
{
"version": "2.0.0",
"tasks": [
{
"label": "npm install",
"type": "npm",
"script": "install",
"options": {
"cwd": "${workspaceFolder}/frontend"
},
"presentation": {
"clear": true,
"panel": "shared",
"showReuseMessage": false
},
"problemMatcher": []
},
{
"label": "npm run build",
"type": "npm",
"script": "build",
"options": {
"cwd": "${workspaceFolder}/frontend"
},
"presentation": {
"clear": true,
"panel": "shared",
"showReuseMessage": false
},
"problemMatcher": []
},
{
"label": "build",
"type": "shell",
"options": {
"cwd": "${workspaceFolder}"
},
"command": "go",
"args": ["build", "-tags", "dev", "-gcflags", "all=-N -l", "-o", "build/bin/vscode.exe"],
"dependsOn": ["npm install", "npm run build"]
}
]
}
在未来,我们希望生成一个自动包含安装和构建步骤的tasks.json
。