on master help sign in
add tree-sitter-git-config (#1426)

* add tree-sitter-git-config * add todo comment for improving filetype check

commite0a99ae51ac099e30dc1039f9ac1059bba90a806 authorMichael Davis <mcarsondavis@gmail.com> dateSun 9 Jan 2022, 08:10 (5 years ago) parent97e12f5
5 files changed+43
.gitmodules+4 book/src/generated/lang-support.md+1 helix-syntax/languages/tree-sitter-git-config+1 languages.toml+10 runtime/queries/git-config/highlights.scm+27
.gitmodules+4
@@ -198,3 +198,7 @@
198198 path = helix-syntax/languages/tree-sitter-make
199199 url = https://github.com/alemuller/tree-sitter-make
200200 shallow = true
201+[submodule "helix-syntax/languages/tree-sitter-git-config"]
202+ path = helix-syntax/languages/tree-sitter-git-config
203+ url = https://github.com/the-mikedavis/tree-sitter-git-config.git
204+ shallow = true
book/src/generated/lang-support.md+1
@@ -12,6 +12,7 @@
1212| elixir | ✓ | | | `elixir-ls` |
1313| fish | ✓ | ✓ | ✓ | |
1414| git-commit | ✓ | | | |
15+| git-config | ✓ | | | |
1516| git-diff | ✓ | | | |
1617| git-rebase | ✓ | | | |
1718| glsl | ✓ | | ✓ | |
helix-syntax/languages/tree-sitter-git-confignew file+1

Submodule changed.

languages.toml+10
@@ -545,3 +545,13 @@ scope = "source.regex"
545545injection-regex = "regex"
546546file-types = ["regex"]
547547roots = []
548+
549+[[language]]
550+name = "git-config"
551+scope = "source.gitconfig"
552+roots = []
553+# TODO: allow specifying file-types as a regex so we can read directory names (e.g. `.git/config`)
554+file-types = [".gitmodules", ".gitconfig"]
555+injection-regex = "git-config"
556+comment-token = "#"
557+indent = { tab-width = 4, unit = "\t" }
runtime/queries/git-config/highlights.scmnew file+27
@@ -0,0 +1,27 @@
1+((section_name) @keyword.directive
2+ (#eq? @keyword.directive "include"))
3+
4+((section_header
5+ (section_name) @keyword.directive
6+ (subsection_name))
7+ (#eq? @keyword.directive "includeIf"))
8+
9+(section_name) @markup.heading
10+(variable (name) @variable.other.member)
11+[(true) (false)] @constant.builtin.boolean
12+(integer) @constant.numeric.integer
13+
14+((string) @string.special.path
15+ (#match? @string.special.path "^(~|./|/)"))
16+
17+[(string) (subsection_name)] @string
18+
19+[
20+ "["
21+ "]"
22+ "\""
23+] @punctuation.bracket
24+
25+"=" @punctuation.delimiter
26+
27+(comment) @comment