aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgbprod <contact@gb-prod.fr>2022-10-18 13:15:07 +0200
committerStephan Seitz <stephan.seitz@fau.de>2022-10-19 16:22:58 -0700
commit1e4b23c26678bd36e3da638183996eaa30e7fba8 (patch)
tree2c71583e213c61e84f33abfb4a941c3644de561a
parentfix(modules): allow non-registered langs to use modules (diff)
downloadnvim-treesitter-1e4b23c26678bd36e3da638183996eaa30e7fba8.tar
nvim-treesitter-1e4b23c26678bd36e3da638183996eaa30e7fba8.tar.gz
nvim-treesitter-1e4b23c26678bd36e3da638183996eaa30e7fba8.tar.bz2
nvim-treesitter-1e4b23c26678bd36e3da638183996eaa30e7fba8.tar.lz
nvim-treesitter-1e4b23c26678bd36e3da638183996eaa30e7fba8.tar.xz
nvim-treesitter-1e4b23c26678bd36e3da638183996eaa30e7fba8.tar.zst
nvim-treesitter-1e4b23c26678bd36e3da638183996eaa30e7fba8.zip
feat(diff): add diff parser
This commit introduce diff parser.
-rw-r--r--CONTRIBUTING.md3
-rw-r--r--README.md1
-rw-r--r--lua/nvim-treesitter/parsers.lua10
-rw-r--r--queries/diff/highlights.scm6
4 files changed, 20 insertions, 0 deletions
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 074722613..ea3cbc408 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -203,6 +203,9 @@ Mainly for markup languages.
@text.note ; info notes
@text.warning ; warning notes
@text.danger ; danger/error notes
+
+@text.diff.add ; added text (for diff files)
+@text.diff.delete ; deleted text (for diff files)
```
#### Tags
diff --git a/README.md b/README.md
index 28ffd55a3..6d95d9333 100644
--- a/README.md
+++ b/README.md
@@ -191,6 +191,7 @@ We are looking for maintainers to add more parsers and to write query files for
- [x] [d](https://github.com/CyberShadow/tree-sitter-d) (experimental, maintained by @nawordar)
- [x] [dart](https://github.com/UserNobody14/tree-sitter-dart) (maintained by @Akin909)
- [x] [devicetree](https://github.com/joelspadin/tree-sitter-devicetree) (maintained by @jedrzejboczar)
+- [x] [diff](https://github.com/the-mikedavis/tree-sitter-diff) (maintained by @gbprod)
- [x] [dockerfile](https://github.com/camdencheek/tree-sitter-dockerfile) (maintained by @camdencheek)
- [x] [dot](https://github.com/rydesun/tree-sitter-dot) (maintained by @rydesun)
- [x] [eex](https://github.com/connorlay/tree-sitter-eex) (maintained by @connorlay)
diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua
index 0f2bdffce..85485aa55 100644
--- a/lua/nvim-treesitter/parsers.lua
+++ b/lua/nvim-treesitter/parsers.lua
@@ -1238,6 +1238,16 @@ list.twig = {
filetype = "twig",
}
+list.diff = {
+ install_info = {
+ url = "https://github.com/the-mikedavis/tree-sitter-diff",
+ branch = "main",
+ files = { "src/parser.c" },
+ },
+ maintainers = { "@gbprod" },
+ filetype = "gitdiff",
+}
+
local M = {
list = list,
filetype_to_parsername = filetype_to_parsername,
diff --git a/queries/diff/highlights.scm b/queries/diff/highlights.scm
new file mode 100644
index 000000000..4b9cbad60
--- /dev/null
+++ b/queries/diff/highlights.scm
@@ -0,0 +1,6 @@
+[(addition) (new_file)] @text.diff.add
+[(deletion) (old_file)] @text.diff.delete
+
+(commit) @constant
+(location) @attribute
+(command) @function