Skip to content
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

[Diff] Refactor for Diff3, Git, and conflicts #4111

Open
wants to merge 127 commits into
base: master
Choose a base branch
from

Conversation

michaelblyons
Copy link
Collaborator

@michaelblyons michaelblyons commented Dec 7, 2024

Big refactor of Diff syntax according to the GNU and SVN documentation. New Git Diff syntax, also used by Git Log.

Thank you to the reviewers!

Notable changes

  • Lots of documentation links
  • Lots of new tests, mostly pulled from relevant documentation
  • Some scope tweaking, but preserving the stacking from [Diff] Make scopes consistent (backwards compatible) #2178 for backwards-compatibility
  • New syntax for Git Diff emails (git am and git format-patch)
    • When the normal Diff syntax detects the "magic" first line, it delegates out to Git Diff instead.
  • New support for
    • Diff3 formats
    • Conflict sections
    • "Combined" unified diffs, only in Git Diff

Potentially controversial

  • Conflicts somewhat with [Common] Add git conflict marker highlighting #4047, but should now be nearly compatible.
  • storage.modifier distinguishes between the two Git file modes (namely 644 and 755)
  • Markup scopes color the ++++---- and similar, even though they're not actually markup.
  • Users and emails are delegated out to Mailmap.
  • Whatever you noticed.

Also include their file modes

[Diff] Change file mode highlighting

[Diff] Loosen file mode match
Includes the Git Commit Message stuff, because that's what it is.
[Diff] Empty file hash
Technically, this is called the "signature."
@deathaxe

This comment was marked as resolved.

@michaelblyons

This comment was marked as resolved.

@deathaxe

This comment was marked as resolved.

@michaelblyons
Copy link
Collaborator Author

michaelblyons commented Dec 18, 2024

I've brought Conflict.sublime-syntax back in, along with a conservative side-by-side highlighter. A more risky side-by-side syntax at michaelblyons#10

@michaelblyons

This comment was marked as resolved.

@jrappen
Copy link
Contributor

jrappen commented Dec 20, 2024

let us know when/if you need any review or feedback 😁

@michaelblyons
Copy link
Collaborator Author

let us know when/if you need any review or feedback 😁

Haha. Sorry if you're flooded in notifications. The PR is a lot better after you and DeathAxe's reviews. I think if you're looking for something, check my PRs to this PR (michaelblyons#11 and michaelblyons#10) and decide if you care about any of the things in the "controversial" heading in OP.

Thanks again.

@deathaxe
Copy link
Collaborator

Empty lines between contexts is ok, but starting arbritary emptly lines between patterns is too much.

@michaelblyons
Copy link
Collaborator Author

There are places where I have considered newlines in stacked scopes, but I am not planning to add an empty line between meta and includes. PackageDev scoping is sufficient to make that distinction very obvious.

deathaxe
deathaxe previously approved these changes Dec 27, 2024
@michaelblyons michaelblyons changed the title [Diff] Organize contexts, add tests, support Git patch emails [Diff] Refactor for Diff3, Git, and conflicts Dec 28, 2024
This commit...

1. adds more detailed scopes to conflict markers
2. adds conflicting blocks to symbol list
3. removes some multi-push and lookaheads
4. adds support for indented fenced diff code blocks
   (allow markers to be preceded by whitespace)
deathaxe
deathaxe previously approved these changes Jan 9, 2025
Unfortunately, line ranges (which start at BOL) cannot be tested.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: Syntax significant T: enhancement Improvement of existing language features
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants