Skip to content

Latest commit

 

History

History
232 lines (161 loc) · 6.93 KB

File metadata and controls

232 lines (161 loc) · 6.93 KB

Contributing to DSCode

First off, thanks for taking the time to contribute! DSCode is a community-driven project, and every contribution matters.

Code of Conduct

This project adheres to the Contributor Covenant Code of Conduct. By participating, you are expected to uphold this code.

Getting Started

Prerequisites

  • Node.js 20+ and npm
  • Rust stable (1.75+) with cargo
  • Platform dependencies:
    • Linux: libwebkit2gtk-4.1-dev, libssl-dev, libgtk-3-dev, librsvg2-dev, patchelf
    • macOS: Xcode Command Line Tools (xcode-select --install)
    • Windows: Microsoft Visual C++ Build Tools

Development Setup

  1. Clone the repository:

    git clone https://github.com/dipankar/dscode.git
    cd dscode
  2. Install frontend dependencies:

    npm install
  3. Start development mode (hot reload):

    npm run tauri:dev

Workspace Structure

DSCode uses a Cargo workspace with 8 members:

Crate Path Purpose
dscode-core crates/dscode-core/ TextBuffer, AppDirectories, shared types
dscode-lsp crates/dscode-lsp/ LSP client, manager, connection pool
dscode-dap crates/dscode-dap/ Debug Adapter Protocol client and pool
dscode-extension-host crates/dscode-extension-host/ Extension host manager, IPC, sandbox, permissions
dscode-terminal crates/dscode-terminal/ Terminal manager, PTY lifecycle
dscode-session crates/dscode-session/ Session manager, extension lifecycle, workspace, config
dscode src-tauri/ Tauri binary (depends on all library crates)
monaco-wasm monaco-wasm/ Monaco Editor WASM bindings

Per-Crate Development

Each library crate can be built and tested independently:

# Build a specific crate
cargo build -p dscode-core

# Test a specific crate
cargo test -p dscode-lsp

# Check a specific crate
cargo check -p dscode-session

Feature Flags

Some crates have optional Tauri integration via feature flags:

  • dscode-extension-hosttauri feature enables AppHandle-dependent IPC
  • dscode-terminaltauri feature enables TauriEventSender
  • dscode-sessiontauri feature enables Tauri IPC providers

The binary crate enables all Tauri features. Library crate tests run without Tauri features.

Build Commands

Run these checks before submitting a pull request:

# Full workspace type check
cargo check --workspace

# Full workspace tests
cargo test --workspace

# Clippy lint (treat warnings as errors)
cargo clippy --workspace -- -D warnings

# Format check
cargo fmt --check

# Frontend TypeScript check
npx tsc --noEmit

# Svelte component type check
npm run check

# Extension host TypeScript check
cd extension-host && npx tsc --noEmit

# Vite production build
npx vite build

# Full Tauri production build
npm run tauri:build

# Lint
npm run lint

Required pre-commit checks

All of the following must pass before committing:

  1. cargo check --workspace — Rust workspace compiles
  2. cargo test --workspace — All workspace tests pass
  3. cargo clippy --workspace -- -D warnings — No clippy warnings
  4. cargo fmt --check — Code is formatted
  5. npx tsc --noEmit — Frontend TypeScript
  6. cd extension-host && npx tsc --noEmit — Extension host TypeScript
  7. npx vite build — Production build succeeds

Code Style

Rust

  • Format with cargo fmt
  • Lint with cargo clippy --workspace -- -D warnings
  • Use tokio::sync::Mutex (never std::sync::Mutex) in async contexts
  • Use tokio::task::spawn_blocking for filesystem I/O in Tauri command handlers
  • Use tracing macros (info!, debug!, error!, warn!) instead of println!/eprintln!
  • Use typed error enums (thiserror) instead of String for internal errors
  • Use pub(crate) for items that shouldn't be part of the crate's public API
  • Document all pub items with /// doc comments

TypeScript & Svelte

  • Format with Prettier: npm run format
  • Lint with ESLint: npm run lint
  • Type-check with npm run check (svelte-check)
  • Use showConfirmPrompt()/showAlertPrompt() from stores/windowPrompt instead of confirm()/alert()
  • Components must unsubscribe from stores in onDestroy() to prevent memory leaks
  • Add ARIA attributes for accessibility (role, aria-label, aria-live)
  • Use focus traps for modal components

Styling

  • CSS custom properties only (VS Code theme-compatible)
  • No Tailwind

Commit Messages

Use Conventional Commits format:

type(scope): description

[optional body]

Types: feat, fix, refactor, docs, test, chore, perf, ci, build

Examples:

  • feat(editor): add multi-cursor support
  • fix(terminal): resolve PTY close race condition
  • refactor(session): extract workspace state into separate module

Pull Request Process

  1. Fork the repository and create a branch from main
  2. Make changes with clear, descriptive commits following conventional commits
  3. Run all pre-commit checks (listed above)
  4. Open a PR against main with a clear description of the change
  5. Ensure CI passes — all type checks, lints, and builds must succeed
  6. Address review feedback promptly
  7. One approval required for merge (may increase as the project grows)

PR Title

Use the same conventional commit format: type(scope): description

Architecture Overview

DSCode has three main layers:

  • Frontend: Svelte 4 + TypeScript + Monaco Editor + xterm.js
  • Backend: Tauri 2.1 (Rust) with tokio async runtime
    • 6 reusable library crates (dscode-core, dscode-lsp, dscode-dap, dscode-extension-host, dscode-terminal, dscode-session)
    • 1 binary crate (src-tauri) that depends on the library crates
  • Extension Host: Separate Node.js process communicating via NNG IPC

See docs/architecture/overview.md for the full architecture document and docs/ for additional design docs.

Testing

# All workspace tests
cargo test --workspace

# Specific crate tests
cargo test -p dscode-core
cargo test -p dscode-lsp
cargo test -p dscode-dap
cargo test -p dscode-extension-host
cargo test -p dscode-terminal
cargo test -p dscode-session

# Extension host tests
cd extension-host && npm test

# Svelte component type check
npm run check

Release Process

All workspace crates share the same version (currently 0.1.0).

  • Version bump process: update workspace.package.version in the root Cargo.toml, then run npm version in each JS package to match.
  • Tag format: v0.1.0
  • Release cadence: bi-weekly patch releases, monthly minor releases during active development.
  • Before release: ensure cargo publish --dry-run passes for every crate in the workspace.

Questions?

Open an issue on GitHub or start a discussion.