aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArthur Deierlein2024-03-17 22:53:30 +0000
committerGitHub2024-03-17 22:53:30 +0000
commit9ec0271873ed484f96342489b4117391e88abcd3 (patch)
tree944b2d543ba4ca5f97d0fc7f02331f5a6a2045d5
parent61f7d9ce2f2d20f4b0bd2f21036eac1f11cb2c5c (diff)
Add support for hyprland config (#9899)
* feat: add hyprland config language * adjust indents to helix * adjust highlights to helix
-rw-r--r--book/src/generated/lang-support.md1
-rw-r--r--languages.toml12
-rw-r--r--runtime/queries/hyprlang/highlights.scm58
-rw-r--r--runtime/queries/hyprlang/indents.scm6
-rw-r--r--runtime/queries/hyprlang/injections.scm3
5 files changed, 80 insertions, 0 deletions
diff --git a/book/src/generated/lang-support.md b/book/src/generated/lang-support.md
index 7792bf59..2cb1e926 100644
--- a/book/src/generated/lang-support.md
+++ b/book/src/generated/lang-support.md
@@ -77,6 +77,7 @@
| hosts | ✓ | | | |
| html | ✓ | | | `vscode-html-language-server` |
| hurl | ✓ | | ✓ | |
+| hyprlang | ✓ | | ✓ | |
| idris | | | | `idris2-lsp` |
| iex | ✓ | | | |
| ini | ✓ | | | |
diff --git a/languages.toml b/languages.toml
index 8fbb98e8..b01da144 100644
--- a/languages.toml
+++ b/languages.toml
@@ -3284,3 +3284,15 @@ indent = { tab-width = 2, unit = " " }
[[grammar]]
name = "ld"
source = { git = "https://github.com/mtoohey31/tree-sitter-ld", rev = "81978cde3844bfc199851e39c80a20ec6444d35e" }
+
+[[language]]
+name = "hyprlang"
+scope = "source.hyprlang"
+roots = ["hyprland.conf"]
+file-types = [ { glob = "hyprland.conf"} ]
+comment-token = "#"
+grammar = "hyprlang"
+
+[[grammar]]
+name = "hyprlang"
+source = { git = "https://github.com/tree-sitter-grammars/tree-sitter-hyprlang", rev = "27af9b74acf89fa6bed4fb8cb8631994fcb2e6f3"}
diff --git a/runtime/queries/hyprlang/highlights.scm b/runtime/queries/hyprlang/highlights.scm
new file mode 100644
index 00000000..bf898c9c
--- /dev/null
+++ b/runtime/queries/hyprlang/highlights.scm
@@ -0,0 +1,58 @@
+(comment) @comment
+
+[
+ "source"
+ "exec"
+ "exec-once"
+] @function.builtin
+
+(keyword
+ (name) @keyword)
+
+(assignment
+ (name) @variable.other.member)
+
+(section
+ (name) @namespace)
+
+(section
+ device: (device_name) @type)
+
+(variable) @variable
+
+"$" @punctuation.special
+
+(boolean) @constant.builtin.boolean
+
+(string) @string
+
+(mod) @constant
+
+[
+ "rgb"
+ "rgba"
+] @function.builtin
+
+[
+ (number)
+ (legacy_hex)
+ (angle)
+ (hex)
+] @constant.numeric
+
+"deg" @type
+
+"," @punctuation.delimiter
+
+[
+ "("
+ ")"
+ "{"
+ "}"
+] @punctuation.bracket
+
+[
+ "="
+ "-"
+ "+"
+] @operator
diff --git a/runtime/queries/hyprlang/indents.scm b/runtime/queries/hyprlang/indents.scm
new file mode 100644
index 00000000..88bfe743
--- /dev/null
+++ b/runtime/queries/hyprlang/indents.scm
@@ -0,0 +1,6 @@
+(section) @indent
+
+(section
+ "}" @outdent)
+
+"}" @extend
diff --git a/runtime/queries/hyprlang/injections.scm b/runtime/queries/hyprlang/injections.scm
new file mode 100644
index 00000000..1f0199ed
--- /dev/null
+++ b/runtime/queries/hyprlang/injections.scm
@@ -0,0 +1,3 @@
+(exec
+ (string) @injection.content
+ (#set! injection.language "bash"))