1. Extension

Extension Memo

Dependi

Rust包管理,https://dependi.io

Even Better Toml

Toml文件支持

Error Lens

错误提示优化

GitLens

Git增强

Github Copilot

代码提示

indent-rainbow

缩进显示优化

Prettier - Code Formatter

代码格式化

REST Client

Rest Api调试

Rust-Analyzer

Rust语言支持

Rust Test Lens

Rust测试支持

Rust Test Explorer

Rust测试概览

TODO Highlight v2

TODO高亮

vscode-icons

图标优化

YAML

Yaml文件支持

2. Cargo Nextest

cargo install cargo-nextest

3. Cargo Deny

cargo install --locked cargo-deny

cargo deny init

cargo deny check

4. Typos

cargo install typos-cli

5. Git Cliff

cargo install git-cliff

# 可修改默认配置cliff.toml
git cliff --init

git cliff -o CHANGELOG.md

6. Cargo Generate

cargo install cargo-generate

cargo help generate

# cargo generate --git https://github.com/github-username/template-name.git
cargo generate --git https://github.com/irecursion/rust-template.git

cargo generate github-username/template-name
cargo generate irecursion/rust-template

7. Pre-Commit

  • pre-commit是代码检查工具,https://pre-commit.com;

pip install pre-commit

pre-commit --version
  • 配置pre-commit,名为:.pre-commit-config.yaml,
    或使用pre-commit sample-config来创建样例;

fail_fast: false
repos:
  - repo: https://github.com/pre-commit/pre-commit-hooks
    rev: v4.3.0
    hooks:
      - id: check-byte-order-marker
      - id: check-case-conflict
      - id: check-merge-conflict
      - id: check-symlinks
      - id: check-yaml
      - id: end-of-file-fixer
      - id: mixed-line-ending
      - id: trailing-whitespace
  - repo: https://github.com/psf/black
    rev: 22.10.0
    hooks:
      - id: black
  - repo: local
    hooks:
      - id: cargo-fmt
        name: cargo fmt
        description: Format files with rustfmt.
        entry: bash -c 'cargo fmt -- --check'
        language: rust
        files: \.rs$
        args: []
      - id: cargo-deny
        name: cargo deny check
        description: Check cargo dependencies
        entry: bash -c 'cargo deny check -d'
        language: rust
        files: \.rs$
        args: []
      - id: typos
        name: typos
        description: check typo
        entry: bash -c 'typos'
        language: rust
        files: \.*$
        pass_filenames: false
      - id: cargo-check
        name: cargo check
        description: Check the package for errors.
        entry: bash -c 'cargo check --all'
        language: rust
        files: \.rs$
        pass_filenames: false
      - id: cargo-clippy
        name: cargo clippy
        description: Lint rust sources
        entry: bash -c 'cargo clippy --all-targets --all-features --tests --benches -- -D warnings'
        language: rust
        files: \.rs$
        pass_filenames: false
      - id: cargo-test
        name: cargo test
        description: unit test for the project
        entry: bash -c 'cargo nextest run --all-features'
        language: rust
        files: \.rs$
        pass_filenames: false
pre-commit install