English | 简体中文
Thank you for your interest in contributing to GPUI-RSX! We welcome contributions from the community.
- Code of Conduct
- Getting Started
- Development Workflow
- Pull Request Process
- Coding Standards
- Testing Guidelines
- Documentation
- Community
This project adheres to a Code of Conduct. By participating, you are expected to uphold this code.
- Rust 1.75 or later
- Cargo
- Git
- Fork the repository on GitHub
- Clone your fork locally:
git clone https://github.com/YOUR_USERNAME/gpui-rsx.git cd gpui-rsx - Add the upstream remote:
git remote add upstream https://github.com/wsafight/gpui-rsx.git
- Build the project:
cargo build
- Run tests to ensure everything works:
cargo test
Create a feature branch for your changes:
git checkout -b feature/amazing-featureBranch naming conventions:
feature/description- for new featuresfix/description- for bug fixesdocs/description- for documentation changesrefactor/description- for code refactoringtest/description- for test improvements
- Make your changes in your feature branch
- Add tests for any new functionality
- Run the standard validation suite:
scripts/check.sh - For quick root-only checks, use
scripts/check.sh --skip-demo - Update documentation if needed
# Run the standard validation suite
scripts/check.sh
# Skip the real-GPUI demo checks when iterating locally
scripts/check.sh --skip-demo
# Run specific test
cargo test test_name
# Generate code coverage report
./coverage.sh # HTML report (opens in browser on macOS)
./coverage.sh --text # Terminal output only
# View macro expansions (for debugging)
cargo install cargo-expand
cargo expand --lib- Update CHANGELOG.md with your changes
- Run
scripts/check.sh - Update documentation if applicable
- Add yourself to the contributors list if it's your first contribution
-
Push your changes to your fork:
git push origin feature/amazing-feature
-
Go to the repository and create a Pull Request
-
Fill in the PR template with:
- Description of changes
- Related issue number (if applicable)
- Type of change (feature, bugfix, docs, etc.)
- Testing done
- Screenshots (if UI changes)
-
Wait for review and address any feedback
- ✅ All tests must pass
- ✅ Code must be formatted with
cargo fmt - ✅ No warnings from
cargo clippy - ✅ Documentation updated (if applicable)
- ✅ CHANGELOG.md updated
- ✅ Descriptive commit messages
- Follow the Rust Style Guide
- Use
cargo fmtwith default settings - Address all
cargo clippywarnings
src/
├── lib.rs # Main macro entry point
├── parser.rs # Syntax parsing logic
└── codegen.rs # Code generation logic
- Use
snake_casefor functions and variables - Use
PascalCasefor types and traits - Use
SCREAMING_SNAKE_CASEfor constants - Prefix private items with underscore when unused
- Write doc comments (
///) for public APIs - Use regular comments (
//) for implementation details - Keep comments concise and clear
- Update comments when code changes
/// Parses an RSX element from the token stream.
///
/// # Arguments
///
/// * `input` - The token stream to parse
///
/// # Returns
///
/// Returns a `Result` containing the parsed element or an error.
///
/// # Examples
///
/// ```rust
/// let element = parse_element(tokens)?;
/// ```
fn parse_element(input: ParseStream) -> Result<Element> {
// Implementation details...
}-
Unit Tests - Test individual functions
#[test] fn test_parse_basic_element() { // Test implementation }
-
Integration Tests - Test macro expansion
- Located in
tests/macro_tests.rs - Cover various RSX syntax patterns
- Located in
- Test both success and failure cases
- Use descriptive test names
- Add comments explaining complex test scenarios
- Keep tests focused and independent
We aim for high test coverage (target: 80%+):
- New features must include tests
- Bug fixes should include regression tests
- Edge cases should be tested
- Run
./coverage.shto generate a local coverage report - Coverage is automatically tracked in CI via Codecov
- Document all public APIs with
///doc comments - Include examples in documentation
- Explain complex algorithms
- Document panics and errors
Update relevant documentation in:
README.md- Project overview and quick startdocs/src/content/docs/getting-started.md- Tutorialdocs/src/content/docs/reference/api.md- API documentationdocs/src/content/docs/guides/best-practices.md- Best practices guideCHANGELOG.md- Version history
Add examples to demonstrate new features:
- Keep examples simple and focused
- Add comments explaining key concepts
- Test examples to ensure they work
- Open an Issue for bugs or feature requests
- Check existing issues before creating new ones
- Use clear, descriptive titles
bug- Something isn't workingenhancement- New feature or requestdocumentation- Documentation improvementsgood first issue- Good for newcomershelp wanted- Extra attention needed
- Be respectful and constructive
- Provide context and details
- Follow up on your issues and PRs
- Help others when possible
English | 简体中文
感谢你对 GPUI-RSX 的关注!我们欢迎社区贡献。
本项目遵循行为准则。参与项目即表示你同意遵守此准则。
- Rust 1.75 或更高版本
- Cargo
- Git
- 在 GitHub 上 Fork 仓库
- 克隆你的 Fork 到本地:
git clone https://github.com/YOUR_USERNAME/gpui-rsx.git cd gpui-rsx - 添加上游远程仓库:
git remote add upstream https://github.com/wsafight/gpui-rsx.git
- 构建项目:
cargo build
- 运行测试确保一切正常:
cargo test
为你的改动创建功能分支:
git checkout -b feature/amazing-feature分支命名规范:
feature/描述- 新功能fix/描述- Bug 修复docs/描述- 文档改进refactor/描述- 代码重构test/描述- 测试改进
- 在功能分支上进行修改
- 为新功能添加测试
- 运行标准验证:
scripts/check.sh - 本地快速迭代时可用
scripts/check.sh --skip-demo - 根据需要更新文档
# 运行标准验证
scripts/check.sh
# 本地迭代时跳过真实 GPUI demo 检查
scripts/check.sh --skip-demo
# 运行特定测试
cargo test test_name
# 生成代码覆盖率报告
./coverage.sh # HTML 报告(macOS 自动打开浏览器)
./coverage.sh --text # 仅终端输出
# 查看宏展开(用于调试)
cargo install cargo-expand
cargo expand --lib- 更新 CHANGELOG.md
- 运行
scripts/check.sh - 更新相关文档
- 如果是首次贡献,将自己添加到贡献者列表
-
推送改动到你的 Fork:
git push origin feature/amazing-feature
-
访问仓库并创建 Pull Request
-
填写 PR 模板:
- 改动描述
- 相关 Issue 编号(如果有)
- 改动类型(功能、修复、文档等)
- 测试情况
- 截图(如果有 UI 改动)
-
等待 Review 并处理反馈
- ✅ 所有测试必须通过
- ✅ 代码必须使用
cargo fmt格式化 - ✅
cargo clippy无警告 - ✅ 文档已更新(如适用)
- ✅ CHANGELOG.md 已更新
- ✅ 提交信息描述清晰
- 遵循 Rust 风格指南
- 使用默认设置的
cargo fmt - 处理所有
cargo clippy警告
src/
├── lib.rs # 主宏入口
├── parser.rs # 语法解析逻辑
└── codegen.rs # 代码生成逻辑
- 函数和变量使用
snake_case - 类型和 trait 使用
PascalCase - 常量使用
SCREAMING_SNAKE_CASE - 未使用的私有项添加下划线前缀
- 公共 API 使用文档注释(
///) - 实现细节使用普通注释(
//) - 保持注释简洁清晰
- 代码改动时同步更新注释
/// 从 token 流中解析 RSX 元素。
///
/// # 参数
///
/// * `input` - 要解析的 token 流
///
/// # 返回
///
/// 返回包含解析元素或错误的 `Result`。
///
/// # 示例
///
/// ```rust
/// let element = parse_element(tokens)?;
/// ```
fn parse_element(input: ParseStream) -> Result<Element> {
// 实现细节...
}-
单元测试 - 测试单个函数
#[test] fn test_parse_basic_element() { // 测试实现 }
-
集成测试 - 测试宏展开
- 位于
tests/macro_tests.rs - 覆盖各种 RSX 语法模式
- 位于
- 同时测试成功和失败情况
- 使用描述性测试名称
- 为复杂测试场景添加注释
- 保持测试专注和独立
我们追求高测试覆盖率(目标:80%+):
- 新功能必须包含测试
- Bug 修复应包含回归测试
- 边界情况应被测试
- 运行
./coverage.sh生成本地覆盖率报告 - CI 自动通过 Codecov 跟踪覆盖率
- 使用
///文档注释记录所有公共 API - 在文档中包含示例
- 解释复杂算法
- 记录 panic 和错误情况
更新相关文档:
README.md- 项目概览和快速开始docs/src/content/docs/zh-cn/getting-started.md- 教程docs/src/content/docs/zh-cn/reference/api.md- API 文档docs/src/content/docs/zh-cn/guides/best-practices.md- 最佳实践指南CHANGELOG.md- 版本历史
添加示例演示新功能:
- 保持示例简单专注
- 添加注释解释关键概念
- 测试示例确保可用
- 为 bug 或功能请求开启 Issue
- 创建新 Issue 前先检查已存在的
- 使用清晰描述性的标题
bug- 功能不正常enhancement- 新功能或请求documentation- 文档改进good first issue- 适合新手help wanted- 需要额外关注
- 保持尊重和建设性
- 提供上下文和细节
- 跟进你的 Issue 和 PR
- 尽可能帮助他人
Thank you for contributing to GPUI-RSX! 🎉
感谢你为 GPUI-RSX 做出贡献!🎉