Home Explore Blog CI



zed

docs/src/languages/diff.md
ed47942bb1c6683a29d6eb60bf70b3824eab9f4e9e845d4a00000003000002b6
# Diff

Diff support is available natively in Zed.

- Tree-sitter: [zed-industries/the-mikedavis/tree-sitter-diff](https://github.com/the-mikedavis/tree-sitter-diff)

## Configuration

Zed will not attempt to format diff files and has [`remove_trailing_whitespace_on_save`](https://zed.dev/docs/configuring-zed#remove-trailing-whitespace-on-save) and [`ensure-final-newline-on-save`](https://zed.dev/docs/configuring-zed#ensure-final-newline-on-save) set to false.

Zed will automatically recognize files with `patch` and `diff` extensions as Diff files. To recognize other extensions, add them to `file_types` in your Zed settings.json:

```json
  "file_types": {
    "Diff": ["dif"]
  },
```

Chunks
c4e761c9 (1st chunk of `docs/src/languages/diff.md`)
Title: Diff Support in Zed
Summary
Zed natively supports diff files using tree-sitter-diff. It handles diff files without formatting, keeping trailing whitespace and final newlines. Files with `.patch` and `.diff` extensions are automatically recognized, and other extensions can be added in the settings.