Skip to content

Feature Request: Entity-level (semantic) diff review in the Code Review panel #9898

@monotykamary

Description

@monotykamary

Pre-submit Checks

Describe the solution you'd like?

Add entity-level (semantic) diff review to the Code Review panel, so that diffs are understood in terms of code entities — functions, classes, structs, methods — rather than raw lines.

Today, Warp's code review panel shows diffs the same way git diff does: as a series of line-level hunks with ±4 lines of context around each change. This works, but it doesn't understand code structure. A one-line change inside a 30-line function still shows just the changed line and a few neighbors — you can't see the whole function without manually expanding. A renamed function shows as "5 deletions, 5 additions" rather than "renamed." A formatting-only change (e.g. cargo fmt, prettier) is indistinguishable from a logic change.

What this would enable:

  1. Entity-scoped context — Instead of ±4 lines around a hunk, show the entire function or class that changed. Unchanged entities between changes are collapsed. You read diffs at the level of "what function changed," not "what lines changed."

  2. Entity-level change classification — The file header and sidebar can say things like:

    • fn validateToken (modified) instead of +3 -1
    • processOrder → processRequest (renamed) instead of +5 -5
    • struct Config (added) / fn oldHelper (deleted)
  3. Smarter filtering — Formatting-only or whitespace-only entity changes can be collapsed by default, letting reviewers focus on logic changes. This is especially valuable after running formatters (cargo fmt, prettier, gofmt).

  4. Entity-aware sidebar — The file sidebar (Code Review: Add tree/directory grouping for changed files #8821 requests tree view) could show a hierarchy: ▸ src/auth.rs → fn validateToken (modified), fn processRequest (renamed), letting reviewers jump directly to the entity they care about.

  5. Better AI context — When attaching diffs to the AI agent, sending entire changed entities (with their names and types) instead of raw line hunks gives the agent more structured understanding of what changed and why.

Why Warp is well-positioned for this:

Warp already ships all the building blocks in-process:

Component Where What it does
Tree-sitter parsing + 32 language grammars crates/languages/ (arborium) Parses code into ASTs for syntax highlighting
Entity extraction crates/languages/grammars/*/identifiers.scm + crates/ai/src/index/file_outline/ Extracts named entities (functions, classes, structs) with name, type, and line number
AST-aware chunking crates/ai/src/index/full_source_code_embedding/chunker/semantic.rs Splits code into fragments along AST node boundaries
Line-level diffing app/src/code/editor/diff.rs (similar crate, Patience algorithm) Computes green/red decorations between base and current content

The missing piece is an entity-matching algorithm that takes entities extracted from two versions of a file and classifies each as modified, renamed, moved, added, or deleted. This is roughly 500–800 lines of new Rust that:

  1. Parses both the base and current file content with the existing tree-sitter infrastructure
  2. Extracts entities using the existing identifiers.scm queries (extended slightly to capture entity end-line and body hash)
  3. Matches entities across versions using three-tier matching: exact name match → structural hash match (same body, different name = rename) → fuzzy similarity
  4. Classifies each match as modified / renamed / moved / added / deleted / unchanged

This would be a new module (e.g. crates/languages/src/semantic_diff.rs) that feeds into the existing code review pipeline — specifically into hidden_lines.rs (entity-scoped context) and code_review_view.rs (entity-level UI). No external dependencies needed; no new tree-sitter grammars needed; works on all platforms including WASM.

Is your feature request related to a problem? Please describe.

When reviewing diffs with many changes — especially after a formatter run — the signal-to-noise ratio is low. Line-based diffs with fixed context windows don't align with how humans read code (by function, by class). Reviewers have to manually expand regions and mentally reconstruct which entity they're looking at. This is a quality-of-life issue rather than a blocker, but it makes code review meaningfully slower and more fatiguing on large changesets.

Additional context

Related issues this would improve:

Tools in this space: Sem (entity-level diff CLI, 26 languages via tree-sitter), Difftastic (structural diff, 30+ languages), SemanticDiff (VS Code + GitHub App). Warp's advantage is that it already has the parser infrastructure in-process.

Operating system (OS)

All

How important is this feature to you?

3

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:code-reviewGit diff views, review UI, review comments, and PR-focused agent flows.enhancementNew feature or request.repro:unknownThe report does not provide enough evidence to estimate reproducibility yet.triagedIssue has received an initial automated triage pass.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions