5
0
mirror of https://github.com/wailsapp/wails.git synced 2025-05-02 20:39:34 +08:00
wails/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/guides/ides.mdx
2022-08-29 20:19:43 +10:00

111 lines
3.3 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 集成开发环境
Wails 旨在提供出色的开发体验。 为此,我们现在支持生成 IDE 特定配置以提供更顺畅的项目设置。
目前,我们支持[Visual Studio Code](https://code.visualstudio.com/),但我们希望尽快支持其他 IDE例如 Goland。
## Visual Studio Code
<p className="text--center">
<img
src={require("@site/static/img/vscode.webp").default}
style={{ width: "75%" }}
/>
</p>
使用`-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:
```json title="tasks.json"
{
"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"]
}
]
}
```
```json title="launch.json"
{
"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`以添加安装和构建步骤:
```json title="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"]
}
]
}
```
:::info 功能改善
在未来,我们希望生成一个自动包含安装和构建步骤的`tasks.json`。
:::