Add highlighting for git_commit (#7147)

https://github.com/zed-industries/zed/assets/45585937/32cf5622-e960-4775-986d-bcfd30c81098

Release Notes:

- Added highlighting for git_commit
This commit is contained in:
d1y 2024-02-01 01:41:19 +08:00 committed by GitHub
parent 39200ec9f7
commit b7ced3943e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 66 additions and 1 deletions

View file

@ -112,6 +112,7 @@ tree-sitter-css.workspace = true
tree-sitter-elixir.workspace = true
tree-sitter-elm.workspace = true
tree-sitter-embedded-template.workspace = true
tree-sitter-gitcommit.workspace = true
tree-sitter-gleam.workspace = true
tree-sitter-glsl.workspace = true
tree-sitter-go.workspace = true

View file

@ -112,7 +112,7 @@ pub fn init(
})],
),
}
language("gitcommit", tree_sitter_gitcommit::language(), vec![]);
language(
"gleam",
tree_sitter_gleam::language(),

View file

@ -0,0 +1,11 @@
name = "Git commit"
path_suffixes = [
# Refer to https://github.com/neovim/neovim/blob/master/runtime/lua/vim/filetype.lua#L1286-L1290
"TAG_EDITMSG",
"MERGE_MSG",
"COMMIT_EDITMSG",
"NOTES_EDITMSG",
"EDIT_DESCRIPTION",
]
line_comments = ["#"]
brackets = []

View file

@ -0,0 +1,34 @@
(comment) @comment
(generated_comment) @comment
(title) @text.title
(text) @text
(branch) @text.reference
(change) @keyword
(filepath) @text.uri
(arrow) @punctuation.delimiter
(subject) @text.title
(subject (overflow) @text)
(prefix (type) @keyword)
(prefix (scope) @parameter)
(prefix [
"("
")"
":"
] @punctuation.delimiter)
(prefix [
"!"
] @punctuation.special)
(message) @text
(trailer (token) @keyword)
(trailer (value) @text)
(breaking_change (token) @text.warning)
(breaking_change (value) @text)
(scissor) @comment
(subject_prefix) @keyword
(ERROR) @error

View file

@ -0,0 +1,8 @@
((diff) @injection.content
(#set! injection.combined)
(#set! injection.language "diff"))
((rebase_command) @injection.content
(#set! injection.combined)
(#set! injection.language "git_rebase"))