New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Diffs should optionally support syntax highlighting #2942
Comments
This could also be used to highlight whitespace errors. In order to do that |
How does this relate to the new Emacs 27 |
|
I still intend to implement this eventually but since I (also still) plan to give the whole diffing functionality a major overhaul, I will delay doing the former until it becomes part of the latter. |
Is this a feature that could benefit from tree-sitter? Pardon me if I'm misunderstanding the feature. |
@rirze fwiw you can get diff highlights via (use-package! magit-delta
:after magit
:config
(setq
magit-delta-default-dark-theme "Monokai Extended"
magit-delta-default-light-theme "Github"
magit-delta-hide-plus-minus-markers nil)
(magit-delta-mode)) |
After adding this feature, the line-prefix (
) continues to be visible and shows whether a given line is an added, removed, or context line. And as before the background color (red/green/gray) continues to be used for the same purpose, but the foreground color.
+
,-
, or(When there is a hunk-internal region, then the parts outside of the region currently lose the background color, so that's a first complication to think about.)
Roughtly speaking this feature requires that for each modified file both versions (
A..B
) have to be visited in a buffer in which font-lock is enabled. After font-lock is done, the text properties are extracted and re-applied in the buffer showing the diff.This obviously is costly and therefore has to be done asynchronously. For large diffs it is quite possible that the user initially sees a diff with no syntax highlighting and that that only appears after a delay.
This is only one of the many improvements I want to make to diffs and it will be a while until I get to it. It's also not one of the most important improvements, improved performance very clearly has to be the priority. Also the changes that I intend to make in order to achieve better performance are actually prerequisits for this feature. Not only in the sense that we "cannot make diff parsing even slower just to get some additional eye-candy", but also for technical reasons. Asynchronous and selective diff parsing in a separate buffer is a most before the feature proposed here can be implemented.)
The text was updated successfully, but these errors were encountered: