Skip to content

Commit

Permalink
Add support for hyprland config (helix-editor#9899)
Browse files Browse the repository at this point in the history
* feat: add hyprland config language

* adjust indents to helix

* adjust highlights to helix
  • Loading branch information
c0rydoras authored and Schuyler Mortimer committed Jul 10, 2024
1 parent cb9b167 commit 75e8659
Show file tree
Hide file tree
Showing 5 changed files with 80 additions and 0 deletions.
1 change: 1 addition & 0 deletions book/src/generated/lang-support.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
| hosts || | | |
| html || | | `vscode-html-language-server` |
| hurl || || |
| hyprlang || || |
| idris | | | | `idris2-lsp` |
| iex || | | |
| ini || | | |
Expand Down
12 changes: 12 additions & 0 deletions languages.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"}
58 changes: 58 additions & 0 deletions runtime/queries/hyprlang/highlights.scm
Original file line number Diff line number Diff line change
@@ -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
6 changes: 6 additions & 0 deletions runtime/queries/hyprlang/indents.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
(section) @indent

(section
"}" @outdent)

"}" @extend
3 changes: 3 additions & 0 deletions runtime/queries/hyprlang/injections.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
(exec
(string) @injection.content
(#set! injection.language "bash"))

0 comments on commit 75e8659

Please sign in to comment.