Skip to content

docs(VSCode Plugin): add build documentation and images for VSCode Plugin#135

Open
Platohykj wants to merge 1 commit intoruyisdk:zhfrom
Platohykj:docs/build
Open

docs(VSCode Plugin): add build documentation and images for VSCode Plugin#135
Platohykj wants to merge 1 commit intoruyisdk:zhfrom
Platohykj:docs/build

Conversation

@Platohykj
Copy link
Copy Markdown

@Platohykj Platohykj commented May 5, 2026

This pull request adds comprehensive documentation for the build system in the RuyiSDK VSCode plugin and makes a minor adjustment to the sidebar ordering of the plugin usage cases. The main focus is on providing users with clear instructions and customization options for building projects with the RuyiSDK extension.

Documentation improvements:

  • Added a new file, VSCode-Plugins/build.mdx, which provides detailed instructions on how to use the RuyiSDK build system in VSCode. The documentation covers build system features, usage workflows, automatic detection rules, integration with virtual environments (venv), output logs, and advanced customization of build rules via .ruyi-build-rules.json.

Sidebar and navigation:

  • Updated VSCode-Plugins/cases/_category_.json to change the sidebar position of the "插件使用案例" section from 7 to 8, reflecting the addition of the new build documentation.

Summary by Sourcery

Document the RuyiSDK VSCode extension build workflow and update related navigation order.

Enhancements:

  • Adjust VSCode plugin sidebar ordering to position the build documentation appropriately among usage sections.

Documentation:

  • Add a new build guide for the RuyiSDK VSCode extension covering build entry points, automatic detection rules, venv integration, logging, and custom build rules via .ruyi-build-rules.json.

Copilot AI review requested due to automatic review settings May 5, 2026 08:27
@sourcery-ai
Copy link
Copy Markdown
Contributor

sourcery-ai Bot commented May 5, 2026

Reviewer's Guide

Adds a new VSCode plugin build documentation page describing the RuyiSDK build system, including venv integration and custom build rules, and adjusts sidebar ordering to insert this page before the usage cases section.

Flow diagram for RuyiSDK build rule selection and execution

flowchart TD
    A_Start[Start Build Request]
    B_CheckCustom[Check .ruyi-build-rules.json in workspace root]
    C_CustomRules[Load custom rules]
    D_DefaultRules[Use built in default rules]
    E_DetectIndicators[Detect indicators in workspace root]
    F_CMake[CMakeLists.txt found]
    G_Make[Makefile or GNUmakefile or makefile found]
    H_CFiles[C source files *.c found in root]
    I_NoMatch[No recognizable build system]
    J_SelectCMake[Select CMake rule]
    K_SelectMake[Select GNU Make rule]
    L_SelectGCC[Select GCC C rule]
    M_CheckVenv[Is Ruyi venv active]
    N_UseVenv[Prepare venv environment]
    O_UseSystem[Use system environment]
    P_LoopSteps[Execute each build step]
    Q_StepOK[Step succeeded]
    R_StepFail[Step failed]
    S_NotifyFail[Show Build failed and stop]
    T_NotifyNoSystem[Show no recognizable build system]
    U_NotifySuccess[Show Build succeeded]

    A_Start --> B_CheckCustom
    B_CheckCustom -->|Yes| C_CustomRules
    B_CheckCustom -->|No| D_DefaultRules
    C_CustomRules --> E_DetectIndicators
    D_DefaultRules --> E_DetectIndicators

    E_DetectIndicators -->|CMake| F_CMake
    E_DetectIndicators -->|Make| G_Make
    E_DetectIndicators -->|C_files| H_CFiles
    E_DetectIndicators -->|None| I_NoMatch

    F_CMake --> J_SelectCMake
    G_Make --> K_SelectMake
    H_CFiles --> L_SelectGCC
    I_NoMatch --> T_NotifyNoSystem

    J_SelectCMake --> M_CheckVenv
    K_SelectMake --> M_CheckVenv
    L_SelectGCC --> M_CheckVenv

    M_CheckVenv -->|Venv active| N_UseVenv
    M_CheckVenv -->|No venv| O_UseSystem

    N_UseVenv --> P_LoopSteps
    O_UseSystem --> P_LoopSteps

    P_LoopSteps --> Q_StepOK
    P_LoopSteps --> R_StepFail

    Q_StepOK --> P_LoopSteps
    R_StepFail --> S_NotifyFail

    P_LoopSteps --> U_NotifySuccess
Loading

File-Level Changes

Change Details Files
Add detailed documentation page for the VSCode plugin build system, including features, workflows, venv behavior, logging, and custom build rules.
  • Create a new build.mdx doc with sidebar position metadata for the VSCode plugin docs.
  • Document supported auto-detected build types (CMake, GNU Make, GCC C) and their detection precedence.
  • Describe how to trigger builds from status bar, editor title, and command palette, along with the typical build workflow.
  • Explain how active Ruyi virtual environments affect build command execution versus using system tools when no venv is active.
  • Describe structure and semantics of .ruyi-build-rules.json, including rule priority, indicators, steps, and useShell behavior, with JSON examples.
VSCode-Plugins/build.mdx
Adjust sidebar/navigation ordering for VSCode plugin usage cases to account for the new build documentation page.
  • Change the sidebar position of the plugin usage cases category so it appears after the new build documentation page in navigation.
VSCode-Plugins/cases/_category_.json

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 2 issues, and left some high level feedback:

  • The new screenshots all use the generic alt text string; consider replacing these with short, descriptive alt texts so the page is more accessible and easier to understand when images fail to load.
  • The description mentions changing the sidebar position of the '插件使用案例' section from 7 to 8, while the new build.mdx uses sidebar_position: 7; double-check the sidebar positions to ensure the new build page and the cases section appear in the intended order.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The new screenshots all use the generic `alt text` string; consider replacing these with short, descriptive alt texts so the page is more accessible and easier to understand when images fail to load.
- The description mentions changing the sidebar position of the '插件使用案例' section from 7 to 8, while the new `build.mdx` uses `sidebar_position: 7`; double-check the sidebar positions to ensure the new build page and the cases section appear in the intended order.

## Individual Comments

### Comment 1
<location path="VSCode-Plugins/build.mdx" line_range="102-104" />
<code_context>
+
+- `.ruyi-build-rules.json`
+
+注意:
+
+- 该文件会**整体替换**扩展内置规则(不是增量合并)
+
+### 7.1 规则文件结构
</code_context>
<issue_to_address>
**suggestion:** Clarify how to preserve built‑in rules when using `.ruyi-build-rules.json`.

Since this behavior can easily surprise users (e.g., unintentionally losing default CMake/Make/GCC behavior), it would help to add a short note on how to start from the built‑in rules (for example, by copying a documented/template rules file) and then customize them, making it clear they must explicitly re‑define all desired behaviors.

```suggestion
注意:

- 该文件会**整体替换**扩展内置规则(不是增量合并)
- 如果你希望在内置规则基础上做少量调整,建议先从扩展提供的示例规则文件或文档中的模板复制一份 `.ruyi-build-rules.json`,然后在此基础上修改;请注意你需要在该文件中**显式定义所有希望保留的行为**,否则对应的默认规则会被完全覆盖。
```
</issue_to_address>

### Comment 2
<location path="VSCode-Plugins/build.mdx" line_range="180-183" />
<code_context>
+      "steps": [
+        {
+          "name": "Compile All",
+          "command": "for f in *.c; do gcc \"$f\" -O2 -Wall -o \"${f%.c}\"; done",
+          "args": [],
+          "workdir": ".",
+          "useShell": true
+        }
+      ]
</code_context>
<issue_to_address>
**suggestion:** Mention shell compatibility / platform considerations for the `useShell` example.

This example assumes a POSIX‑compatible shell (`for`, `do`, `done`, `$f`, `${f%.c}`). Please note what shell `useShell: true` actually uses on each platform, and call out that this command won’t work as‑is on Windows shells like `cmd.exe` or PowerShell (or briefly describe the differing behavior).
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread VSCode-Plugins/build.mdx
Comment on lines +102 to +104
注意:

- 该文件会**整体替换**扩展内置规则(不是增量合并)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: Clarify how to preserve built‑in rules when using .ruyi-build-rules.json.

Since this behavior can easily surprise users (e.g., unintentionally losing default CMake/Make/GCC behavior), it would help to add a short note on how to start from the built‑in rules (for example, by copying a documented/template rules file) and then customize them, making it clear they must explicitly re‑define all desired behaviors.

Suggested change
注意:
- 该文件会**整体替换**扩展内置规则(不是增量合并)
注意:
- 该文件会**整体替换**扩展内置规则(不是增量合并)
- 如果你希望在内置规则基础上做少量调整,建议先从扩展提供的示例规则文件或文档中的模板复制一份 `.ruyi-build-rules.json`,然后在此基础上修改;请注意你需要在该文件中**显式定义所有希望保留的行为**,否则对应的默认规则会被完全覆盖。

Comment thread VSCode-Plugins/build.mdx
Comment on lines +180 to +183
"command": "for f in *.c; do gcc \"$f\" -O2 -Wall -o \"${f%.c}\"; done",
"args": [],
"workdir": ".",
"useShell": true
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: Mention shell compatibility / platform considerations for the useShell example.

This example assumes a POSIX‑compatible shell (for, do, done, $f, ${f%.c}). Please note what shell useShell: true actually uses on each platform, and call out that this command won’t work as‑is on Windows shells like cmd.exe or PowerShell (or briefly describe the differing behavior).

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a new documentation page describing the RuyiSDK VS Code plugin’s build system (including rule detection, venv behavior, logs, and custom .ruyi-build-rules.json), and updates sidebar ordering to accommodate the new page.

Changes:

  • Added VSCode-Plugins/build.mdx build-system documentation with screenshots and advanced customization examples.
  • Adjusted the sidebar ordering for the “插件使用案例” section to keep navigation order consistent after adding the new page.

Reviewed changes

Copilot reviewed 2 out of 6 changed files in this pull request and generated 2 comments.

File Description
VSCode-Plugins/cases/category.json Moves the “插件使用案例” category position to keep sidebar ordering aligned with the new build page.
VSCode-Plugins/build.mdx New build documentation page covering workflows, venv interaction, logging, and custom build rule configuration.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread VSCode-Plugins/build.mdx Outdated
Comment on lines +31 to +36
![alt text](./image/image-8.png)
- 编辑器标题栏按钮(`Build Project`)
![alt text](./image/image-9.png)
- 命令面板执行 `Ruyi: Build Project`
![alt text](./image/image-10.png)

Comment thread VSCode-Plugins/build.mdx Outdated
Comment on lines +73 to +81
- 需要开发者自行套用虚拟环境里的工具链[^1]
- 一键编译功能不会帮助开发者自动把该工具链注入到项目配置中

当没有激活 venv 时:

- 构建将使用系统环境中的工具(例如系统 `cmake`、`gcc`、`make`)

[^1]: 例如 CMake 项目通常需要开发者自行指定 `CMAKE_TOOLCHAIN_FILE`、Preset 或相关缓存项;Makefile 项目通常需要自行设置 `CC`、`CXX` 或其他工具链变量。

…ugin

Signed-off-by: Platohykj <guanting.plct@isrc.iscas.ac.cn>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants