From ea4e96815bfdb9f3a87b1c9395ac76cdd356feed Mon Sep 17 00:00:00 2001 From: seshotake Date: Mon, 31 Oct 2022 00:32:22 +0200 Subject: [PATCH 1/2] add highlights for env and ini file formats --- book/src/generated/lang-support.md | 2 ++ languages.toml | 26 ++++++++++++++++++++++++++ runtime/queries/env/highlights.scm | 19 +++++++++++++++++++ runtime/queries/ini/highlights.scm | 6 ++++++ 4 files changed, 53 insertions(+) create mode 100644 runtime/queries/env/highlights.scm create mode 100644 runtime/queries/ini/highlights.scm diff --git a/book/src/generated/lang-support.md b/book/src/generated/lang-support.md index 545ec635b4b9..c187c769b1dc 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 9c0293f0bb55..8ac43737a0f0 100644 --- a/languages.toml +++ b/languages.toml @@ -1917,3 +1917,29 @@ roots = [] [[grammar]] name = "xml" source = { git = "https://github.com/RenjiSann/tree-sitter-xml", rev = "422528a43630db6dcc1e222d1c5ee3babd559473" } + +[[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/seshotake/tree-sitter-ini", rev = "d46570961fa12a1ab66ec7fab86741299c0090ed" } diff --git a/runtime/queries/env/highlights.scm b/runtime/queries/env/highlights.scm new file mode 100644 index 000000000000..6a27e8e5a049 --- /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 000000000000..6277a0676b0d --- /dev/null +++ b/runtime/queries/ini/highlights.scm @@ -0,0 +1,6 @@ +(section_name) @namespace + +(setting_name) @keyword +(setting_value) @string + +(comment) @comment From c580c02e6db094a45c9db3d7265fdefe6d40a592 Mon Sep 17 00:00:00 2001 From: seshotake Date: Mon, 31 Oct 2022 18:48:56 +0200 Subject: [PATCH 2/2] update repo to https://github.com/justinmk/tree-sitter-ini --- languages.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/languages.toml b/languages.toml index 8ac43737a0f0..6bdaebd3b109 100644 --- a/languages.toml +++ b/languages.toml @@ -1942,4 +1942,4 @@ roots = [] [[grammar]] name = "ini" -source = { git = "https://github.com/seshotake/tree-sitter-ini", rev = "d46570961fa12a1ab66ec7fab86741299c0090ed" } +source = { git = "https://github.com/justinmk/tree-sitter-ini", rev = "4d247fb876b4ae6b347687de4a179511bf67fcbc" }