Skip to content

Commit

Permalink
[Diff] Scope diff --git line meta.function-call
Browse files Browse the repository at this point in the history
  • Loading branch information
deathaxe committed Dec 19, 2024
1 parent e94d9b7 commit 15622fc
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 19 deletions.
2 changes: 1 addition & 1 deletion Diff/Diff (Basic).sublime-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ contexts:

path-separators:
- match: /|\\
scope: punctuation.separator.sequence.diff
scope: punctuation.separator.path.diff
- match: \B\.\.(?=/|\\)
scope: constant.other.path.parent.diff
- match: \B\.(?=/|\\)
Expand Down
33 changes: 18 additions & 15 deletions Git Formats/Git Diff.sublime-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -268,11 +268,12 @@ contexts:

# https://git-scm.com/docs/diff-format#generate_patch_text_with_p
diffs:
- match: ^(diff) ((--)(?:git|combined|cc))
- match: ^(diff)( ((--)(?:git|combined|cc)))
captures:
1: variable.function.diff
2: variable.parameter.diff
3: punctuation.definition.parameter.diff
1: meta.function-call.identifier.git variable.function.diff
2: meta.function-call.arguments.git
3: variable.parameter.diff
4: punctuation.definition.parameter.diff
push: [diff-header, diff-file-header]

# https://git-scm.com/docs/git-format-patch#Documentation/git-format-patch.txt---no-signatureltsignaturegt
Expand All @@ -290,19 +291,21 @@ contexts:

diff-file-header:
- meta_scope: meta.toc-list.git
- meta_content_scope: meta.function-call.arguments.git
- include: pop-eol
# TODO: Quoted file names https://git-scm.com/docs/git-config#Documentation/git-config.txt-corequotePath
- match: \b(a|b|ours|theirs)(/)
captures:
1: constant.language.diff
2: punctuation.separator.sequence.diff
push:
- meta_scope: entity.name.diff
- match: \\.
scope: constant.character.escape.git
- match: (?=\s|$)
pop: 1
- include: path-separators
- match: (?:a|b|ours|theirs)(?=/)
scope: variable.parameter.source.diff
push: diff-file-header-path

diff-file-header-path:
- meta_include_prototype: false
- meta_content_scope: meta.path.diff entity.name.diff
- match: (?=\s|$)
pop: 1
- match: \\.
scope: constant.character.escape.git
- include: path-separators

diff-header:
- meta_prepend: true
Expand Down
17 changes: 14 additions & 3 deletions Git Formats/tests/syntax_test_git_diff.patch
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ Much better, no?
\ ^ markup.inserted.diff
app/assets/images/logo.jpeg | Bin 0 -> 50966 bytes
\^^^^^^^^^^^^^^^^^^^^^^^^^^^ entity.name.diff
\ ^ punctuation.separator.sequence.diff
\ ^ punctuation.separator.sequence.diff
\ ^ punctuation.separator.sequence.diff
\ ^ punctuation.separator.path.diff
\ ^ punctuation.separator.path.diff
\ ^ punctuation.separator.path.diff
\ ^ punctuation.separator.sequence.diff
\ ^^^ storage.type.diff
\ ^ meta.number.integer.decimal.diff constant.numeric.value.diff markup.deleted.diff
Expand All @@ -98,6 +98,17 @@ Much better, no?
\ ^ punctuation.definition.diff

diff --git a/Gemfile b/Gemfile
\^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.block.header.diff meta.toc-list.git
\^^^ meta.function-call.identifier.git variable.function.diff
\ ^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.git
\ ^^^^^ variable.parameter.diff
\ ^^ punctuation.definition.parameter.diff
\ ^ variable.parameter.source.diff
\ ^^^^^^^^ meta.path.diff entity.name.diff
\ ^ punctuation.separator.path.diff
\ ^ variable.parameter.source.diff
\ ^^^^^^^^ meta.path.diff entity.name.diff
\ ^ punctuation.separator.path.diff
index c661619..989efe8 100644
--- a/Gemfile
+++ b/Gemfile
Expand Down

0 comments on commit 15622fc

Please sign in to comment.