Skip to content

Commit

Permalink
feat: Nginx support (helix-editor#12309)
Browse files Browse the repository at this point in the history
Co-authored-by: Denis Gruzdev <codingjerk@gmail.com>
  • Loading branch information
2 people authored and rmburg committed Jan 20, 2025
1 parent 08d9493 commit 5c9ef47
Show file tree
Hide file tree
Showing 4 changed files with 73 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 @@ -140,6 +140,7 @@
| msbuild || || |
| nasm ||| | |
| nestedtext |||| |
| nginx || | | |
| nickel || || `nls` |
| nim |||| `nimlangserver` |
| nix ||| | `nil`, `nixd` |
Expand Down
18 changes: 18 additions & 0 deletions languages.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4004,3 +4004,21 @@ indent = { tab-width = 4, unit = " " }
[[grammar]]
name = "vento"
source = { git = "https://github.com/ventojs/tree-sitter-vento", rev = "3321077d7446c1b3b017c294fd56ce028ed817fe" }

[[language]]
name = "nginx"
scope = "source.nginx"
injection-regex = "nginx"
file-types = [
{ glob = "sites-available/*.conf" },
{ glob = "sites-enabled/*.conf" },
{ glob = "nginx.conf" },
{ glob = "conf.d/*.conf" }
]
roots = ["nginx.conf"]
comment-token = "#"
indent = { tab-width = 4, unit = " " }

[[grammar]]
name = "nginx"
source = { git = "https://gitlab.com/joncoole/tree-sitter-nginx", rev = "b4b61db443602b69410ab469c122c01b1e685aa0" }
45 changes: 45 additions & 0 deletions runtime/queries/nginx/highlights.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
(comment) @comment

(block_directive
(directive) @type)

[
"{"
"}"
"("
")"
"["
"]"
] @punctuation.bracket

(simple_directive
(directive) @function)

[
";"
] @punctuation.delimiter

((generic) @keyword
(#any-of? @keyword
"on"
"off"
"any"
"auto"))

(modifier) @operator

(generic) @variable

(string) @string

(number) @constant.numeric
(metric) @constant.numeric

(variable) @variable.parameter

(regex) @string

(modifier) @keyword.operator

(lua_block_directive
"access_by_lua_block" @function)
9 changes: 9 additions & 0 deletions runtime/queries/nginx/injections.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
((lua_code) @injection.content
(#set! injection.language "lua")
(#set! injection.combined))

((regex) @injection.content
(#set! injection.language "regex"))

((comment) @injection.content
(#set! injection.language "comment"))

0 comments on commit 5c9ef47

Please sign in to comment.