diff --git a/.gitmodules b/.gitmodules index f6a0fdc49341f..0b56b868d2358 100644 --- a/.gitmodules +++ b/.gitmodules @@ -194,3 +194,7 @@ path = helix-syntax/languages/tree-sitter-regex url = https://github.com/tree-sitter/tree-sitter-regex.git 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 diff --git a/book/src/generated/lang-support.md b/book/src/generated/lang-support.md index daf8b00614ac6..ed6a4fbcc4c8b 100644 --- a/book/src/generated/lang-support.md +++ b/book/src/generated/lang-support.md @@ -12,6 +12,7 @@ | elixir | ✓ | | | `elixir-ls` | | fish | ✓ | ✓ | ✓ | | | git-commit | ✓ | | | | +| git-config | ✓ | | | | | git-diff | ✓ | | | | | git-rebase | ✓ | | | | | glsl | ✓ | | ✓ | | diff --git a/helix-syntax/languages/tree-sitter-git-config b/helix-syntax/languages/tree-sitter-git-config new file mode 160000 index 0000000000000..0e4f0baf90b57 --- /dev/null +++ b/helix-syntax/languages/tree-sitter-git-config @@ -0,0 +1 @@ +Subproject commit 0e4f0baf90b57e5aeb62dcdbf03062c6315d43ea diff --git a/languages.toml b/languages.toml index 3e2e7b15c730a..53c1372c29f22 100644 --- a/languages.toml +++ b/languages.toml @@ -537,3 +537,12 @@ scope = "source.regex" injection-regex = "regex" file-types = ["regex"] roots = [] + +[[language]] +name = "git-config" +scope = "source.gitconfig" +roots = [] +file-types = [".gitmodules", ".gitconfig"] +injection-regex = "git-config" +comment-token = "#" +indent = { tab-width = 4, unit = "\t" } diff --git a/runtime/queries/git-config/highlights.scm b/runtime/queries/git-config/highlights.scm new file mode 100644 index 0000000000000..84767edc63396 --- /dev/null +++ b/runtime/queries/git-config/highlights.scm @@ -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