-
Notifications
You must be signed in to change notification settings - Fork 615
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
i18n(zh-cn): update Debug/index.mdx #2494
base: v2
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for tauri-v2 ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify site configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some typo and style issues. Text is not checked :) maybe later if I have some more time.
<LinkCard title="在 VS Code 中调试" href="/zh-cn/develop/debug/vscode" /> | ||
<LinkCard title="在 RustRover 中调试" href="/zh-cn/develop/debug/rustrover" /> | ||
</CardGrid> | ||
随着逐渐深入Tauri,你可能碰到一个问题需要调试。错误详情在许多地方输出,Tauri 提供了很多工具时代调试过程更加直接。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing empty line.
```rs frame=none | ||
fn main() { | ||
// Whether the current instance was started with `tauri dev` or not. | ||
#[cfg(dev)] | ||
{ | ||
// `tauri dev` only code | ||
} | ||
if cfg!(dev) { | ||
// `tauri dev` only code | ||
} else { | ||
// `tauri build` only code | ||
} | ||
let is_dev: bool = tauri::is_dev(); | ||
|
||
// Whether debug assertions are enabled or not. This is true for `tauri dev` and `tauri build --debug`. | ||
#[cfg(debug_assertions)] | ||
{ | ||
// Debug only code | ||
} | ||
if cfg!(debug_assertions) { | ||
// Debug only code | ||
} else { | ||
// Production only code | ||
} | ||
} | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Untranslated comment in code.
|
||
## Rust控制台 | ||
|
||
第一个查看错误的地方就是Rust控制台。在终端中运行,比如,`tauri dev`。你可以使用下面的代码从一个rust文件输出一些内容到控制台: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
第一个查看错误的地方就是Rust控制台。在终端中运行,比如,`tauri dev`。你可以使用下面的代码从一个rust文件输出一些内容到控制台: | |
第一个查看错误的地方就是 Rust 控制台。在终端中运行,比如,`tauri dev`。你可以使用下面的代码从一个 rust 文件输出一些内容到控制台: |
- Missing white space;
- Use full-width punctuation.
println!("Message from Rust: {}", msg); | ||
``` | ||
|
||
有时候你rust代码中可能有一个错误,rust编译器会给你提供许多信息。比如,如果`tauri dev` 命令执行崩溃,你可以在Linux和macOS中重新运行: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
有时候你rust代码中可能有一个错误,rust编译器会给你提供许多信息。比如,如果`tauri dev` 命令执行崩溃,你可以在Linux和macOS中重新运行: | |
有时候你 rust 代码中可能有一个错误,rust 编译器会给你提供许多信息。比如,如果 `tauri dev` 命令执行崩溃,你可以在 Linux 和 macOS 中重新运行: |
Missing whitespace.
RUST_BACKTRACE=1 tauri dev | ||
``` | ||
|
||
或者在Windows (PowerShell): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
或者在Windows (PowerShell): | |
或者在 Windows (PowerShell): |
Whitespace and punctuation.
Visual Studio窗口调试器是一个只能在Windows中使用的调试器,它比[`vscode-lldb`]更快,以及更好的支持一些Rust特性,比如枚举。 | ||
### 先决条件 | ||
|
||
安装[C/C++](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools) 扩展, 按照 https://code.visualstudio.com/docs/cpp/config-msvc#_prerequisites 安装 Visual Studio Windows Debugger. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
安装[C/C++](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools) 扩展, 按照 https://code.visualstudio.com/docs/cpp/config-msvc#_prerequisites 安装 Visual Studio Windows Debugger. | |
安装 [C/C++](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools) 扩展, 按照 https://code.visualstudio.com/docs/cpp/config-msvc#_prerequisites 安装 Visual Studio Windows Debugger. |
Missing whitespace
```json title=".vscode/launch.json" | ||
{ | ||
// Use IntelliSense to learn about possible attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": "Launch App Debug", | ||
"type": "cppvsdbg", | ||
"request": "launch", | ||
// change the exe name to your actual exe name | ||
// (to debug release builds, change `target/debug` to `release/debug`) | ||
"program": "${workspaceRoot}/src-tauri/target/debug/your-app-name-here.exe", | ||
"cwd": "${workspaceRoot}", | ||
"preLaunchTask": "ui:dev" | ||
} | ||
] | ||
} | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Untranslated comment
} | ||
``` | ||
|
||
注意它没有使用Tauri CLI,所以特有的CLI 特性没有执行。`tasks.json`和`lldb`一样,希望你添加一组配置,如果你想要在启动前进行编译,把`launch.json`的 `preLaunchTask`指向它。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
注意它没有使用Tauri CLI,所以特有的CLI 特性没有执行。`tasks.json`和`lldb`一样,希望你添加一组配置,如果你想要在启动前进行编译,把`launch.json`的 `preLaunchTask`指向它。 | |
注意它没有使用 Tauri CLI,所以特有的 CLI 特性没有执行。`tasks.json` 和 `lldb` 一样,希望你添加一组配置,如果你想要在启动前进行编译,把 `launch.json`的 `preLaunchTask` 指向它。 |
Missing whitespace
|
||
注意它没有使用Tauri CLI,所以特有的CLI 特性没有执行。`tasks.json`和`lldb`一样,希望你添加一组配置,如果你想要在启动前进行编译,把`launch.json`的 `preLaunchTask`指向它。 | ||
|
||
这里是一个示例:运行开发服务器(相当于`beforeDevCommand`),作为一个组进行汇编(`cargo build`),把`launch.json`中的`preLaunchTask` 配置改成`dev`(或者是你给配置的命名)。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里是一个示例:运行开发服务器(相当于`beforeDevCommand`),作为一个组进行汇编(`cargo build`),把`launch.json`中的`preLaunchTask` 配置改成`dev`(或者是你给配置的命名)。 | |
这里是一个示例:运行开发服务器(相当于 `beforeDevCommand`),作为一个组进行汇编(`cargo build`),把 `launch.json` 中的 `preLaunchTask` 配置改成 `dev` (或者是你给配置的命名)。 |
Missing whitespace and wrong punctuation.
```json title=".vscode/tasks.json" | ||
{ | ||
// See https://go.microsoft.com/fwlink/?LinkId=733558 | ||
// for the documentation about the tasks.json format | ||
"version": "2.0.0", | ||
"tasks": [ | ||
{ | ||
"label": "build:debug", | ||
"type": "cargo", | ||
"command": "build" | ||
}, | ||
{ | ||
"label": "ui:dev", | ||
"type": "shell", | ||
// `dev` keeps running in the background | ||
// ideally you should also configure a `problemMatcher` | ||
// see https://code.visualstudio.com/docs/editor/tasks#_can-a-background-task-be-used-as-a-prelaunchtask-in-launchjson | ||
"isBackground": true, | ||
// change this to your `beforeDevCommand`: | ||
"command": "yarn", | ||
"args": ["dev"] | ||
}, | ||
{ | ||
"label": "dev", | ||
"dependsOn": ["build:debug", "ui:dev"], | ||
"group": { | ||
"kind": "build" | ||
} | ||
} | ||
] | ||
} | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Untranslated comment
update Debug/index.mdx for Chinese doc.I translate the whole file to Chinese language