-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Add diff syntax definition #450
Conversation
In general, +1, although I would appreciate it if you can make Git depend on diff instead of still being stand-alone. |
I don’t own the Git syntax though. Would be happy to help if @lgiraudel thinks this is a good idea. |
|
||
// Match inserted and deleted lines. Support both +/- and >/< styles. | ||
'deleted': /^[-\<](?![-\<]).+$/m, | ||
'inserted': /^[\+\>](?![\+\>]).+$/m, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why escape the angle brackets? Also +
doesn’t need escaping inside a character class.
Also, what’s the negative lookahead trying to prevent? What happens if the line starts with e.g. ++ or >>?
Overall looks nice, see a few minor comments. Re:git, once I merge this, feel free to submit a PR to make it dependent on diff. It makes sense. Just because you don’t own it doesn’t mean you can’t suggest changes to it! |
Thanks @LeaVerou, amended. Sorry for the changes taking so long, I totally forgot about this. :( |
(You should not have included the autohotkey changes in this PR) |
@uranusjr Is it intended that those two lines in unified diff are matched as "coord"?
EDIT: The separator |
@Golmote Yes that is what I intended, since they sort of act as separators between diff chunks, like the |
Largely based on
git
’s definition forinserted
anddeleted
, but expanded to supportcoord
styles includingdiff -c
anddiff -u
.>
/<
syntax.!
syntax in context diff.Example page included.
For the
!
syntax I aliasedimportant
todiff
.