-
-
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
Improve git show
highlighting
#1735
Comments
I have played around with the Git Log syntax definition, and have added support for highlighting diffs - the patch (including the fix for #1632) is: --- Shipped Packages/Git Formats/Git Log.sublime-syntax 2021-04-02 13:30:54
+++ Packages/Git Formats/Git Log.sublime-syntax 2021-07-16 23:43:48
@@ -13,13 +13,37 @@
main:
# 1st header line
# commit d9d9fb804f5d61c13ba2f8746af33a9f3c609075
- - match: (?:(commit)\s+(\h{7,}))?\s*\n
- scope: meta.header.git.commit markup.raw.block.git.log
+ - match: ^(commit)\s+(\h{7,})
captures:
1: keyword.other.commit.git.log
2: constant.other.hash.git.log
- embed: commit-header
- escape: (?=^commit\s)
+ push:
+ - meta_scope: meta.header.git.commit markup.raw.block.git.log
+ - match: $\n?
+ scope: meta.header.git.commit markup.raw.block.git.log
+ pop: true
+ embed: commit-header
+ escape: (?=^(?:commit|diff)\s)
+ - match: (\()(HEAD)\s*(->)
+ captures:
+ 1: punctuation.section.parens.begin.git.log
+ 2: support.type.git.log
+ 3: punctuation.separator.mapping.git.log
+ push:
+ - match: \)
+ scope: punctuation.section.parens.end.git.log
+ pop: true
+ - match: \bmaster\b
+ scope: entity.other.branch-name.master.git.log
+ - match: (\w+)(?:(/)(\w+))?
+ scope: entity.other.branch-name.git.log
+ - match: ','
+ scope: punctuation.separator.sequence.git.log
+ - match: '^(?=diff\s)'
+ embed: scope:source.shell.bash
+ escape: $
+ - match: (?=^index\s)
+ set: scope:source.diff
commit-header:
# All header attributes are mappings of `key: value` format. and here's an example of how I will try to make a PR to the Packages repo with these changes soon ™️ |
The relevant PR to packages was merged quickly, is this still blocked on supporting newer syntax features? |
git show
output is currently detected and highlighted as gitlog, which means the diff part is not highlighted. Would be great if both of them would be.The text was updated successfully, but these errors were encountered: