aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorseshotake2022-11-01 00:23:09 +0000
committerGitHub2022-11-01 00:23:09 +0000
commited7ea8c9ba639daebdbc81630bd789aeb344e2d4 (patch)
treefce07e1367d1e4c0e4d457aa54c2a1f72ba2bbf4
parent9df43584924a72be88f537ac432e5976430fa3f1 (diff)
add highlights for env and ini file formats (#4536)
-rw-r--r--book/src/generated/lang-support.md2
-rw-r--r--languages.toml27
-rw-r--r--runtime/queries/env/highlights.scm19
-rw-r--r--runtime/queries/ini/highlights.scm6
4 files changed, 53 insertions, 1 deletions
diff --git a/book/src/generated/lang-support.md b/book/src/generated/lang-support.md
index 38d121b5..411e67b8 100644
--- a/book/src/generated/lang-support.md
+++ b/book/src/generated/lang-support.md
@@ -27,6 +27,7 @@
| elixir | ✓ | ✓ | | `elixir-ls` |
| elm | ✓ | | | `elm-language-server` |
| elvish | ✓ | | | `elvish` |
+| env | ✓ | | | |
| erb | ✓ | | | |
| erlang | ✓ | ✓ | | `erlang_ls` |
| esdl | ✓ | | | |
@@ -53,6 +54,7 @@
| html | ✓ | | | `vscode-html-language-server` |
| idris | | | | `idris2-lsp` |
| iex | ✓ | | | |
+| ini | ✓ | | | |
| java | ✓ | | | `jdtls` |
| javascript | ✓ | ✓ | ✓ | `typescript-language-server` |
| jsdoc | ✓ | | | |
diff --git a/languages.toml b/languages.toml
index ee31f372..95c37945 100644
--- a/languages.toml
+++ b/languages.toml
@@ -1938,4 +1938,29 @@ indent = { tab-width = 2, unit = " " }
[[grammar]]
name = "wit"
source = { git = "https://github.com/hh9527/tree-sitter-wit", rev = "c917790ab9aec50c5fd664cbfad8dd45110cfff3" }
-
+
+[[language]]
+name = "env"
+scope = "source.env"
+file-types = [".env", ".env.local", ".env.development", ".env.production"]
+injection-regex = "env"
+comment-token = "#"
+indent = { tab-width = 4, unit = "\t" }
+roots = []
+
+[[grammar]]
+name = "env"
+source = { git = "https://github.com/seshotake/tree-sitter-env", rev = "e6c6bb1e7b51d481cba463fe949f083cf22d81f7" }
+
+[[language]]
+name = "ini"
+scope = "source.ini"
+file-types = ["ini"]
+injection-regex = "ini"
+comment-token = "#"
+indent = { tab-width = 4, unit = "\t" }
+roots = []
+
+[[grammar]]
+name = "ini"
+source = { git = "https://github.com/justinmk/tree-sitter-ini", rev = "4d247fb876b4ae6b347687de4a179511bf67fcbc" }
diff --git a/runtime/queries/env/highlights.scm b/runtime/queries/env/highlights.scm
new file mode 100644
index 00000000..6a27e8e5
--- /dev/null
+++ b/runtime/queries/env/highlights.scm
@@ -0,0 +1,19 @@
+(env_variable (quoted_string)) @string
+(env_variable (unquoted_string)) @string
+
+(env_key) @keyword
+
+((variable) @keyword
+ (#match? @keyword "^([A-Z][A-Z_0-9]*)$"))
+
+[
+ "{"
+ "}"
+] @punctuation.bracket
+
+[
+ "$"
+ "="
+] @operator
+
+(comment) @comment \ No newline at end of file
diff --git a/runtime/queries/ini/highlights.scm b/runtime/queries/ini/highlights.scm
new file mode 100644
index 00000000..6277a067
--- /dev/null
+++ b/runtime/queries/ini/highlights.scm
@@ -0,0 +1,6 @@
+(section_name) @namespace
+
+(setting_name) @keyword
+(setting_value) @string
+
+(comment) @comment