mirror of
https://github.com/zed-industries/zed.git
synced 2024-09-18 18:08:07 +03:00
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:
parent
39200ec9f7
commit
b7ced3943e
10
Cargo.lock
generated
10
Cargo.lock
generated
@ -8764,6 +8764,15 @@ dependencies = [
|
||||
"tree-sitter",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tree-sitter-gitcommit"
|
||||
version = "0.3.3"
|
||||
source = "git+https://github.com/gbprod/tree-sitter-gitcommit#e8d9eda4e5ea0b08aa39d48dab0f6553058fbe0f"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"tree-sitter",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tree-sitter-gleam"
|
||||
version = "0.34.0"
|
||||
@ -10323,6 +10332,7 @@ dependencies = [
|
||||
"tree-sitter-elixir",
|
||||
"tree-sitter-elm",
|
||||
"tree-sitter-embedded-template",
|
||||
"tree-sitter-gitcommit",
|
||||
"tree-sitter-gleam",
|
||||
"tree-sitter-glsl",
|
||||
"tree-sitter-go",
|
||||
|
@ -140,6 +140,7 @@ tree-sitter-css = { git = "https://github.com/tree-sitter/tree-sitter-css", rev
|
||||
tree-sitter-elixir = { git = "https://github.com/elixir-lang/tree-sitter-elixir", rev = "a2861e88a730287a60c11ea9299c033c7d076e30" }
|
||||
tree-sitter-elm = { git = "https://github.com/elm-tooling/tree-sitter-elm", rev = "692c50c0b961364c40299e73c1306aecb5d20f40" }
|
||||
tree-sitter-embedded-template = "0.20.0"
|
||||
tree-sitter-gitcommit = { git = "https://github.com/gbprod/tree-sitter-gitcommit" }
|
||||
tree-sitter-gleam = { git = "https://github.com/gleam-lang/tree-sitter-gleam", rev = "58b7cac8fc14c92b0677c542610d8738c373fa81" }
|
||||
tree-sitter-glsl = { git = "https://github.com/theHamsta/tree-sitter-glsl", rev = "2a56fb7bc8bb03a1892b4741279dd0a8758b7fb3" }
|
||||
tree-sitter-go = { git = "https://github.com/tree-sitter/tree-sitter-go", rev = "aeb2f33b366fd78d5789ff104956ce23508b85db" }
|
||||
|
@ -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
|
||||
|
@ -112,7 +112,7 @@ pub fn init(
|
||||
})],
|
||||
),
|
||||
}
|
||||
|
||||
language("gitcommit", tree_sitter_gitcommit::language(), vec![]);
|
||||
language(
|
||||
"gleam",
|
||||
tree_sitter_gleam::language(),
|
||||
|
11
crates/zed/src/languages/gitcommit/config.toml
Normal file
11
crates/zed/src/languages/gitcommit/config.toml
Normal 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 = []
|
34
crates/zed/src/languages/gitcommit/highlights.scm
Normal file
34
crates/zed/src/languages/gitcommit/highlights.scm
Normal 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
|
8
crates/zed/src/languages/gitcommit/injections.scm
Normal file
8
crates/zed/src/languages/gitcommit/injections.scm
Normal 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"))
|
||||
|
Loading…
Reference in New Issue
Block a user