Skip to content

Feature: Match VSCode's diff output #734

@Othmanosx

Description

@Othmanosx

Prerequisites

Proposal

Proposal
Make @pierre/diffs produce diffs that visually match what VSCode's diff editor shows for the same change.

Two screenshots of the same diff, side by side:

Current @pierre/diffs output:
Image

VSCode's diff editor output:
Image
As you can see, the VSCode one is much cleaner.

How can we get pierre's output to match VSCode's? Is this something the lib could do by default, or is there a configuration / extension point we've missed? Saw #366 in passing ignoreWhitespace: true on parseDiffFromFile helps for whitespace-only changes, but the gap above remains on hunks with mixed changes.

Motivation and context

We're building a PR reviewer on top of @pierre/diffs. Reviewers spend most of their day in VSCode's diff editor, so they notice immediately when a diff in our app reads differently than VSCode for the same files.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions