Skip to content

Conversation

@tidefield
Copy link
Contributor

@tidefield tidefield commented Sep 18, 2025

Per #23371 (reply in thread), the issue is not new and I don't know how to solve the problem more holistically yet.

All of the native themes don't have spec for @diff.plus and @diff.minus leaving addition and deletion not being highlighted. For diff file, the most valuable highlighting comes from exactly what we're missing. Hence, I think this is worth fixing.

Perhaps, the ideal fix would be standardizing and documenting captures such as @diff.plus and @diff.minus on https://zed.dev/docs/extensions/languages#syntax-highlighting for theme writers to adopt. But the existing list of captures seems to be language-agnostic so I'm not sure if that's the best way forward.

Per tree-sitter-grammars/tree-sitter-diff#18 (comment), tree-sitter-diff's author prefers using @keyword and @string so that tree-sitter highlight can work out of the box. So it seems to be an ok choice for Zed.

Another approach is just adding @diff.plus and @diff.minus to the native themes. Let me know if I should pursue this instead.

Before
Screenshot 2025-09-18 at 11 16 14 AM

After
Screenshot 2025-09-18 at 12 11 15 PM
Screenshot 2025-09-18 at 12 12 14 PM

Closes zed-industries/extensions#490

Release Notes:

  • Fixed highlighting for addition and deletion for diff language

@cla-bot
Copy link

cla-bot bot commented Sep 18, 2025

We require contributors to sign our Contributor License Agreement, and we don't have @daivinhtran on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'.

@tidefield
Copy link
Contributor Author

@cla-bot check

@cla-bot
Copy link

cla-bot bot commented Sep 18, 2025

We require contributors to sign our Contributor License Agreement, and we don't have @daivinhtran on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'.

@cla-bot
Copy link

cla-bot bot commented Sep 18, 2025

The cla-bot has been summoned, and re-checked this pull request!

"diff" @function
(argument) @variable.parameter)

(filename) @string.special.path
Copy link
Contributor Author

@tidefield tidefield Sep 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(filename) was conflicting with (old_file) and (new_file).

If we choose to keep (filename), then we should remove others.

@tidefield
Copy link
Contributor Author

@cla-bot check

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Sep 18, 2025
@cla-bot
Copy link

cla-bot bot commented Sep 18, 2025

The cla-bot has been summoned, and re-checked this pull request!

@zed-industries-bot
Copy link

zed-industries-bot commented Sep 18, 2025

Warnings
⚠️

This PR is missing release notes.

Please add a "Release Notes" section that describes the change:

Release Notes:

- Added/Fixed/Improved ...

If your change is not user-facing, you can use "N/A" for the entry:

Release Notes:

- N/A

Generated by 🚫 dangerJS against c515eb4

@tidefield
Copy link
Contributor Author

Just a note for reviewer @cole-miller. 🙏

Let me know if I should have approached this differently.

@MrSubidubi MrSubidubi assigned MrSubidubi and unassigned cole-miller Oct 2, 2025
@tidefield
Copy link
Contributor Author

Hi @MrSubidubi . Do you have any feedback on this PR?

@MrSubidubi
Copy link
Member

@daivinhtran Will soon get to this, sorry for the delay! Didn't have enouzgh time on my hands the past week as I was mostly OOO, but will do my best to get back to you this week. Wanted to check coverage before merging, otherwise looks good!

@cla-bot
Copy link

cla-bot bot commented Nov 20, 2025

We require contributors to sign our Contributor License Agreement, and we don't have @tidefield on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'.

@cla-bot cla-bot bot removed the cla-signed The user has signed the Contributor License Agreement label Nov 20, 2025
Copy link
Member

@MrSubidubi MrSubidubi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry to leave you hanging for so long! I initially wanted to both query all extensions and get some data on how this is available in themes as well as add proper fallback behavior, but due to time constraints, I didn't get to that 😓

I'll try to pick that up during Quality Week hopefully, for now the comments will do.

Thank you again and sorry for having you wait this long!

@MrSubidubi
Copy link
Member

Huh, seems to be something weird with the CLA. Did you change anything in the meantime?

@tidefield
Copy link
Contributor Author

@cla-bot check

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Nov 20, 2025
@cla-bot
Copy link

cla-bot bot commented Nov 20, 2025

The cla-bot has been summoned, and re-checked this pull request!

@tidefield
Copy link
Contributor Author

tidefield commented Nov 20, 2025

@MrSubidubi I changed my github username 😁 should be good now

Copy link
Member

@MrSubidubi MrSubidubi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, that explains it. Again, thank you for the change, sorry for the long delay and also thanks for the quick follow-up!

Lastly, congratulations to your first contribution! 🎉

@MrSubidubi MrSubidubi merged commit e033829 into zed-industries:main Nov 20, 2025
29 checks passed
mikayla-maki pushed a commit that referenced this pull request Nov 20, 2025
Per
#23371 (reply in thread),
the issue is not new and I don't know how to solve the problem more
holistically yet.

All of the native themes don't have spec for `@diff.plus` and
`@diff.minus` leaving addition and deletion not being highlighted. For
diff file, the most valuable highlighting comes from exactly what we're
missing. Hence, I think this is worth fixing.

Perhaps, the ideal fix would be standardizing and documenting captures
such as `@diff.plus` and `@diff.minus` on
https://zed.dev/docs/extensions/languages#syntax-highlighting for theme
writers to adopt. But the existing list of captures seems to be
language-agnostic so I'm not sure if that's the best way forward.

Per
tree-sitter-grammars/tree-sitter-diff#18 (comment),
`tree-sitter-diff`'s author prefers using `@keyword` and `@string` so
that `tree-sitter highlight` can work out of the box. So it seems to be
an ok choice for Zed.

Another approach is just adding `@diff.plus` and `@diff.minus` to the
native themes. Let me know if I should pursue this instead.

Before
<img width="668" height="328" alt="Screenshot 2025-09-18 at 11 16 14 AM"
src="https://github.com/user-attachments/assets/d9a5b3b5-b9ef-4e74-883f-831630fb431e"
/>

After
<img width="1011" height="404" alt="Screenshot 2025-09-18 at 12 11
15 PM"
src="https://github.com/user-attachments/assets/9cf453c0-30df-4d17-99e9-f2297865f12a"
/>
<img width="915" height="448" alt="Screenshot 2025-09-18 at 12 12 14 PM"
src="https://github.com/user-attachments/assets/9e7438a6-9009-4136-b841-1f8e1356bc9b"
/>



Closes zed-industries/extensions#490


Release Notes:
- Fixed highlighting for addition and deletion for diff language

---------

Co-authored-by: MrSubidubi <finn@zed.dev>
@JosephTLyons JosephTLyons moved this to 🚢 Shipped by Community in Git board Nov 26, 2025
11happy pushed a commit to 11happy/zed that referenced this pull request Dec 1, 2025
Per
zed-industries#23371 (reply in thread),
the issue is not new and I don't know how to solve the problem more
holistically yet.

All of the native themes don't have spec for `@diff.plus` and
`@diff.minus` leaving addition and deletion not being highlighted. For
diff file, the most valuable highlighting comes from exactly what we're
missing. Hence, I think this is worth fixing.

Perhaps, the ideal fix would be standardizing and documenting captures
such as `@diff.plus` and `@diff.minus` on
https://zed.dev/docs/extensions/languages#syntax-highlighting for theme
writers to adopt. But the existing list of captures seems to be
language-agnostic so I'm not sure if that's the best way forward.

Per
tree-sitter-grammars/tree-sitter-diff#18 (comment),
`tree-sitter-diff`'s author prefers using `@keyword` and `@string` so
that `tree-sitter highlight` can work out of the box. So it seems to be
an ok choice for Zed.

Another approach is just adding `@diff.plus` and `@diff.minus` to the
native themes. Let me know if I should pursue this instead.

Before
<img width="668" height="328" alt="Screenshot 2025-09-18 at 11 16 14 AM"
src="https://github.com/user-attachments/assets/d9a5b3b5-b9ef-4e74-883f-831630fb431e"
/>

After
<img width="1011" height="404" alt="Screenshot 2025-09-18 at 12 11
15 PM"
src="https://github.com/user-attachments/assets/9cf453c0-30df-4d17-99e9-f2297865f12a"
/>
<img width="915" height="448" alt="Screenshot 2025-09-18 at 12 12 14 PM"
src="https://github.com/user-attachments/assets/9e7438a6-9009-4136-b841-1f8e1356bc9b"
/>



Closes zed-industries/extensions#490


Release Notes:
- Fixed highlighting for addition and deletion for diff language

---------

Co-authored-by: MrSubidubi <finn@zed.dev>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement

Projects

Status: 🚢 Shipped by Community

Development

Successfully merging this pull request may close these issues.

.patch

4 participants