Rust
While iterating, run clippy for the crate you changed only (
cargo clippy -p <crate> --all-targets -- -D warnings), once, before committing. The plugin SDK and official plugins are separate workspaces; CI also lints them for wasm32-wasip2.
Conventions:
- Each crate’s
lib.rs(and each significant module) starts with a//!doc comment stating its contract. Keep it current when the contract changes. - Crates keep their own error types internally (
thiserror,anyhow) and convert toIdeErrorat their public edge. - Doc comments on Tauri commands and IPC types become JSDoc in
src/bindings.ts; write them for the frontend reader. - Log with
tracing, notprintln!. Inopenidea-server, stdout carries the protocol. - Blocking or long work goes to
spawn_blocking/ rayon and honours aCancellationToken.
TypeScript and React
pnpm knip fails on an export nobody imports, a file nobody reaches or a dependency nobody uses. Delete dead code rather than suppressing it; exports used only inside their own file are allowed.
Conventions:
- Import app modules through the
@/alias (@/platform/ipc,@/workbench/contributions). - State lives in zustand stores; features expose behaviour through actions and contributions, not exported singletons other features import.
- Styling and UI rules: see UI guidelines. Text: see Localization.
Pre-commit hook
pnpm install installs a pre-commit hook (simple-git-hooks + lint-staged) that runs on staged files:
oxlint --fixon JavaScript and TypeScript files;oxfmton all files (TOML and generated files are ignored by its config);rustfmt --edition 2024on Rust files.
Comments
Keep comments sparse and purposeful, and match the surrounding style:- Explain why, a constraint, or a non-obvious contract; don’t narrate what the next line does.
- Reference the issue number when a line exists because of a specific bug report (
(#1878)), as existing code does. - Don’t keep change logs or commented-out code in comments; history is in git.
Generated files
Never edit these by hand; regenerate them:Commit and PR titles
Use Conventional Commits with a scope:fix(editor): keep the caret visible after folding, feat(vcs): …, perf(index): …. The repository-wide formatting commit is listed in .git-blame-ignore-revs; use git blame --ignore-revs-file .git-blame-ignore-revs to skip it.