diff --git a/Diff/Diff (Basic).sublime-syntax b/Diff/Diff (Basic).sublime-syntax index a3acd7f467..0a83f85151 100644 --- a/Diff/Diff (Basic).sublime-syntax +++ b/Diff/Diff (Basic).sublime-syntax @@ -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\.(?=/|\\) diff --git a/Git Formats/Git Diff.sublime-syntax b/Git Formats/Git Diff.sublime-syntax index 7c48b43001..a18bae1d35 100644 --- a/Git Formats/Git Diff.sublime-syntax +++ b/Git Formats/Git Diff.sublime-syntax @@ -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 @@ -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 diff --git a/Git Formats/tests/syntax_test_git_diff.patch b/Git Formats/tests/syntax_test_git_diff.patch index 578f62205a..86359c7f16 100644 --- a/Git Formats/tests/syntax_test_git_diff.patch +++ b/Git Formats/tests/syntax_test_git_diff.patch @@ -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 @@ -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