Skip to content

Commit ed7ea8c

Browse files
authored
add highlights for env and ini file formats (#4536)
1 parent 9df4358 commit ed7ea8c

File tree

4 files changed

+53
-1
lines changed

4 files changed

+53
-1
lines changed

book/src/generated/lang-support.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
| elixir ||| | `elixir-ls` |
2828
| elm || | | `elm-language-server` |
2929
| elvish || | | `elvish` |
30+
| env || | | |
3031
| erb || | | |
3132
| erlang ||| | `erlang_ls` |
3233
| esdl || | | |
@@ -53,6 +54,7 @@
5354
| html || | | `vscode-html-language-server` |
5455
| idris | | | | `idris2-lsp` |
5556
| iex || | | |
57+
| ini || | | |
5658
| java || | | `jdtls` |
5759
| javascript |||| `typescript-language-server` |
5860
| jsdoc || | | |

languages.toml

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1938,4 +1938,29 @@ indent = { tab-width = 2, unit = " " }
19381938
[[grammar]]
19391939
name = "wit"
19401940
source = { git = "https://github.com/hh9527/tree-sitter-wit", rev = "c917790ab9aec50c5fd664cbfad8dd45110cfff3" }
1941-
1941+
1942+
[[language]]
1943+
name = "env"
1944+
scope = "source.env"
1945+
file-types = [".env", ".env.local", ".env.development", ".env.production"]
1946+
injection-regex = "env"
1947+
comment-token = "#"
1948+
indent = { tab-width = 4, unit = "\t" }
1949+
roots = []
1950+
1951+
[[grammar]]
1952+
name = "env"
1953+
source = { git = "https://github.com/seshotake/tree-sitter-env", rev = "e6c6bb1e7b51d481cba463fe949f083cf22d81f7" }
1954+
1955+
[[language]]
1956+
name = "ini"
1957+
scope = "source.ini"
1958+
file-types = ["ini"]
1959+
injection-regex = "ini"
1960+
comment-token = "#"
1961+
indent = { tab-width = 4, unit = "\t" }
1962+
roots = []
1963+
1964+
[[grammar]]
1965+
name = "ini"
1966+
source = { git = "https://github.com/justinmk/tree-sitter-ini", rev = "4d247fb876b4ae6b347687de4a179511bf67fcbc" }

runtime/queries/env/highlights.scm

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
(env_variable (quoted_string)) @string
2+
(env_variable (unquoted_string)) @string
3+
4+
(env_key) @keyword
5+
6+
((variable) @keyword
7+
(#match? @keyword "^([A-Z][A-Z_0-9]*)$"))
8+
9+
[
10+
"{"
11+
"}"
12+
] @punctuation.bracket
13+
14+
[
15+
"$"
16+
"="
17+
] @operator
18+
19+
(comment) @comment

runtime/queries/ini/highlights.scm

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
(section_name) @namespace
2+
3+
(setting_name) @keyword
4+
(setting_value) @string
5+
6+
(comment) @comment

0 commit comments

Comments
 (0)