-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add support for syntax highlighting for diff/patch files
- Loading branch information
Showing
8 changed files
with
222 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
org.eclipse.tm4e.language_pack/syntaxes/diff/diff.example.diff
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- script1.py 2024-05-16 10:00:00.000000000 +0000 | ||
+++ script2.py 2024-05-16 10:00:00.000000000 +0000 | ||
@@ -1,6 +1,9 @@ | ||
# script1.py | ||
def greet(name): | ||
- print("Hello, " + name + "!") | ||
+ print("Hi, " + name + "!") | ||
|
||
def calculate_sum(a, b): | ||
- return a + b | ||
+ result = a + b | ||
+ print("The sum of", a, "and", b, "is", result) | ||
+ return result * 2 | ||
+ |
11 changes: 11 additions & 0 deletions
11
org.eclipse.tm4e.language_pack/syntaxes/diff/diff.language-configuration.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"comments": { | ||
"lineComment": "#", | ||
"blockComment": [ "#", " " ] | ||
}, | ||
"brackets": [ | ||
["{", "}"], | ||
["[", "]"], | ||
["(", ")"] | ||
] | ||
} |
160 changes: 160 additions & 0 deletions
160
org.eclipse.tm4e.language_pack/syntaxes/diff/diff.tmLanguage.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,160 @@ | ||
{ | ||
"information_for_contributors": [ | ||
"This file has been converted from https://github.com/textmate/diff.tmbundle/blob/master/Syntaxes/Diff.plist", | ||
"If you want to provide a fix or improvement, please create a pull request against the original repository.", | ||
"Once accepted there, we are happy to receive an update request." | ||
], | ||
"version": "https://github.com/textmate/diff.tmbundle/commit/0593bb775eab1824af97ef2172fd38822abd97d7", | ||
"name": "Diff", | ||
"scopeName": "source.diff", | ||
"patterns": [ | ||
{ | ||
"captures": { | ||
"1": { | ||
"name": "punctuation.definition.separator.diff" | ||
} | ||
}, | ||
"match": "^((\\*{15})|(={67})|(-{3}))$\\n?", | ||
"name": "meta.separator.diff" | ||
}, | ||
{ | ||
"match": "^\\d+(,\\d+)*(a|d|c)\\d+(,\\d+)*$\\n?", | ||
"name": "meta.diff.range.normal" | ||
}, | ||
{ | ||
"captures": { | ||
"1": { | ||
"name": "punctuation.definition.range.diff" | ||
}, | ||
"2": { | ||
"name": "meta.toc-list.line-number.diff" | ||
}, | ||
"3": { | ||
"name": "punctuation.definition.range.diff" | ||
} | ||
}, | ||
"match": "^(@@)\\s*(.+?)\\s*(@@)($\\n?)?", | ||
"name": "meta.diff.range.unified" | ||
}, | ||
{ | ||
"captures": { | ||
"3": { | ||
"name": "punctuation.definition.range.diff" | ||
}, | ||
"4": { | ||
"name": "punctuation.definition.range.diff" | ||
}, | ||
"6": { | ||
"name": "punctuation.definition.range.diff" | ||
}, | ||
"7": { | ||
"name": "punctuation.definition.range.diff" | ||
} | ||
}, | ||
"match": "^(((\\-{3}) .+ (\\-{4}))|((\\*{3}) .+ (\\*{4})))$\\n?", | ||
"name": "meta.diff.range.context" | ||
}, | ||
{ | ||
"match": "^diff --git a/.*$\\n?", | ||
"name": "meta.diff.header.git" | ||
}, | ||
{ | ||
"match": "^diff (-|\\S+\\s+\\S+).*$\\n?", | ||
"name": "meta.diff.header.command" | ||
}, | ||
{ | ||
"captures": { | ||
"4": { | ||
"name": "punctuation.definition.from-file.diff" | ||
}, | ||
"6": { | ||
"name": "punctuation.definition.from-file.diff" | ||
}, | ||
"7": { | ||
"name": "punctuation.definition.from-file.diff" | ||
} | ||
}, | ||
"match": "(^(((-{3}) .+)|((\\*{3}) .+))$\\n?|^(={4}) .+(?= - ))", | ||
"name": "meta.diff.header.from-file" | ||
}, | ||
{ | ||
"captures": { | ||
"2": { | ||
"name": "punctuation.definition.to-file.diff" | ||
}, | ||
"3": { | ||
"name": "punctuation.definition.to-file.diff" | ||
}, | ||
"4": { | ||
"name": "punctuation.definition.to-file.diff" | ||
} | ||
}, | ||
"match": "(^(\\+{3}) .+$\\n?| (-) .* (={4})$\\n?)", | ||
"name": "meta.diff.header.to-file" | ||
}, | ||
{ | ||
"captures": { | ||
"3": { | ||
"name": "punctuation.definition.inserted.diff" | ||
}, | ||
"6": { | ||
"name": "punctuation.definition.inserted.diff" | ||
} | ||
}, | ||
"match": "^(((>)( .*)?)|((\\+).*))$\\n?", | ||
"name": "markup.inserted.diff" | ||
}, | ||
{ | ||
"captures": { | ||
"1": { | ||
"name": "punctuation.definition.changed.diff" | ||
} | ||
}, | ||
"match": "^(!).*$\\n?", | ||
"name": "markup.changed.diff" | ||
}, | ||
{ | ||
"captures": { | ||
"3": { | ||
"name": "punctuation.definition.deleted.diff" | ||
}, | ||
"6": { | ||
"name": "punctuation.definition.deleted.diff" | ||
} | ||
}, | ||
"match": "^(((<)( .*)?)|((-).*))$\\n?", | ||
"name": "markup.deleted.diff" | ||
}, | ||
{ | ||
"begin": "^(#)", | ||
"captures": { | ||
"1": { | ||
"name": "punctuation.definition.comment.diff" | ||
} | ||
}, | ||
"comment": "Git produces unified diffs with embedded comments\"", | ||
"end": "\\n", | ||
"name": "comment.line.number-sign.diff" | ||
}, | ||
{ | ||
"match": "^index [0-9a-f]{7,40}\\.\\.[0-9a-f]{7,40}.*$\\n?", | ||
"name": "meta.diff.index.git" | ||
}, | ||
{ | ||
"captures": { | ||
"1": { | ||
"name": "punctuation.separator.key-value.diff" | ||
}, | ||
"2": { | ||
"name": "meta.toc-list.file-name.diff" | ||
} | ||
}, | ||
"match": "^Index(:) (.+)$\\n?", | ||
"name": "meta.diff.index" | ||
}, | ||
{ | ||
"match": "^Only in .*: .*$\\n?", | ||
"name": "meta.diff.only-in" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters