mirror of
https://github.com/zed-industries/zed.git
synced 2024-11-07 20:39:04 +03:00
Add syntax highlighting for TOML
This commit is contained in:
parent
0c587ae73c
commit
3a878c8d6c
10
Cargo.lock
generated
10
Cargo.lock
generated
@ -5228,6 +5228,15 @@ dependencies = [
|
||||
"tree-sitter",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tree-sitter-toml"
|
||||
version = "0.5.1"
|
||||
source = "git+https://github.com/tree-sitter/tree-sitter-toml?rev=342d9be207c2dba869b9967124c679b5e6fd0ebe#342d9be207c2dba869b9967124c679b5e6fd0ebe"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"tree-sitter",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tree-sitter-typescript"
|
||||
version = "0.20.1"
|
||||
@ -5856,6 +5865,7 @@ dependencies = [
|
||||
"tree-sitter-json 0.20.0",
|
||||
"tree-sitter-markdown",
|
||||
"tree-sitter-rust",
|
||||
"tree-sitter-toml",
|
||||
"tree-sitter-typescript",
|
||||
"unindent",
|
||||
"url",
|
||||
|
@ -89,6 +89,7 @@ tree-sitter-c = "0.20.1"
|
||||
tree-sitter-json = { git = "https://github.com/tree-sitter/tree-sitter-json", rev = "137e1ce6a02698fc246cdb9c6b886ed1de9a1ed8" }
|
||||
tree-sitter-rust = "0.20.1"
|
||||
tree-sitter-markdown = { git = "https://github.com/MDeiml/tree-sitter-markdown", rev = "330ecab87a3e3a7211ac69bbadc19eabecdb1cca" }
|
||||
tree-sitter-toml = { git = "https://github.com/tree-sitter/tree-sitter-toml", rev = "342d9be207c2dba869b9967124c679b5e6fd0ebe" }
|
||||
tree-sitter-typescript = "0.20.1"
|
||||
url = "2.2"
|
||||
|
||||
|
@ -37,6 +37,11 @@ pub fn build_language_registry(login_shell_env_loaded: Task<()>) -> LanguageRegi
|
||||
tree_sitter_rust::language(),
|
||||
Some(Arc::new(rust::RustLspAdapter)),
|
||||
),
|
||||
(
|
||||
"toml",
|
||||
tree_sitter_toml::language(),
|
||||
None, //
|
||||
),
|
||||
(
|
||||
"tsx",
|
||||
tree_sitter_typescript::language_tsx(),
|
||||
|
3
crates/zed/src/languages/toml/brackets.scm
Normal file
3
crates/zed/src/languages/toml/brackets.scm
Normal file
@ -0,0 +1,3 @@
|
||||
("[" @open "]" @close)
|
||||
("{" @open "}" @close)
|
||||
("\"" @open "\"" @close)
|
9
crates/zed/src/languages/toml/config.toml
Normal file
9
crates/zed/src/languages/toml/config.toml
Normal file
@ -0,0 +1,9 @@
|
||||
name = "TOML"
|
||||
path_suffixes = ["toml"]
|
||||
line_comment = "# "
|
||||
autoclose_before = ",]}"
|
||||
brackets = [
|
||||
{ start = "{", end = "}", close = true, newline = true },
|
||||
{ start = "[", end = "]", close = true, newline = true },
|
||||
{ start = "\"", end = "\"", close = true, newline = false },
|
||||
]
|
33
crates/zed/src/languages/toml/highlights.scm
Normal file
33
crates/zed/src/languages/toml/highlights.scm
Normal file
@ -0,0 +1,33 @@
|
||||
; Properties
|
||||
;-----------
|
||||
|
||||
(bare_key) @property
|
||||
(quoted_key) @property
|
||||
|
||||
; Literals
|
||||
;---------
|
||||
|
||||
(boolean) @constant
|
||||
(comment) @comment
|
||||
(string) @string
|
||||
(integer) @number
|
||||
(float) @number
|
||||
(offset_date_time) @string.special
|
||||
(local_date_time) @string.special
|
||||
(local_date) @string.special
|
||||
(local_time) @string.special
|
||||
|
||||
; Punctuation
|
||||
;------------
|
||||
|
||||
"." @punctuation.delimiter
|
||||
"," @punctuation.delimiter
|
||||
|
||||
"=" @operator
|
||||
|
||||
"[" @punctuation.bracket
|
||||
"]" @punctuation.bracket
|
||||
"[[" @punctuation.bracket
|
||||
"]]" @punctuation.bracket
|
||||
"{" @punctuation.bracket
|
||||
"}" @punctuation.bracket
|
0
crates/zed/src/languages/toml/indents.scm
Normal file
0
crates/zed/src/languages/toml/indents.scm
Normal file
15
crates/zed/src/languages/toml/outline.scm
Normal file
15
crates/zed/src/languages/toml/outline.scm
Normal file
@ -0,0 +1,15 @@
|
||||
(table
|
||||
.
|
||||
"["
|
||||
.
|
||||
(_) @name) @item
|
||||
|
||||
(table_array_element
|
||||
.
|
||||
"[["
|
||||
.
|
||||
(_) @name) @item
|
||||
|
||||
(pair
|
||||
.
|
||||
(_) @name) @item
|
Loading…
Reference in New Issue
Block a user