Skip to content

Commit

Permalink
add tree-sitter-git-config (#1426)
Browse files Browse the repository at this point in the history
* add tree-sitter-git-config

* add todo comment for improving filetype check
  • Loading branch information
the-mikedavis authored Jan 9, 2022
1 parent 97e12f5 commit e0a99ae
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -198,3 +198,7 @@
path = helix-syntax/languages/tree-sitter-make
url = https://github.com/alemuller/tree-sitter-make
shallow = true
[submodule "helix-syntax/languages/tree-sitter-git-config"]
path = helix-syntax/languages/tree-sitter-git-config
url = https://github.com/the-mikedavis/tree-sitter-git-config.git
shallow = true
1 change: 1 addition & 0 deletions book/src/generated/lang-support.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
| elixir || | | `elixir-ls` |
| fish |||| |
| git-commit || | | |
| git-config || | | |
| git-diff || | | |
| git-rebase || | | |
| glsl || || |
Expand Down
1 change: 1 addition & 0 deletions helix-syntax/languages/tree-sitter-git-config
Submodule tree-sitter-git-config added at 0e4f0b
10 changes: 10 additions & 0 deletions languages.toml
Original file line number Diff line number Diff line change
Expand Up @@ -545,3 +545,13 @@ scope = "source.regex"
injection-regex = "regex"
file-types = ["regex"]
roots = []

[[language]]
name = "git-config"
scope = "source.gitconfig"
roots = []
# TODO: allow specifying file-types as a regex so we can read directory names (e.g. `.git/config`)
file-types = [".gitmodules", ".gitconfig"]
injection-regex = "git-config"
comment-token = "#"
indent = { tab-width = 4, unit = "\t" }
27 changes: 27 additions & 0 deletions runtime/queries/git-config/highlights.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
((section_name) @keyword.directive
(#eq? @keyword.directive "include"))

((section_header
(section_name) @keyword.directive
(subsection_name))
(#eq? @keyword.directive "includeIf"))

(section_name) @markup.heading
(variable (name) @variable.other.member)
[(true) (false)] @constant.builtin.boolean
(integer) @constant.numeric.integer

((string) @string.special.path
(#match? @string.special.path "^(~|./|/)"))

[(string) (subsection_name)] @string

[
"["
"]"
"\""
] @punctuation.bracket

"=" @punctuation.delimiter

(comment) @comment

0 comments on commit e0a99ae

Please sign in to comment.