Skip to content

Commit

Permalink
feat: Add language support for nginx config files
Browse files Browse the repository at this point in the history
  • Loading branch information
codingjerk committed Oct 6, 2024
1 parent f6d39cb commit a01338a
Show file tree
Hide file tree
Showing 4 changed files with 63 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 @@ -134,6 +134,7 @@
| move || | | |
| msbuild || || |
| nasm ||| | |
| nginx || | | |
| nickel || || `nls` |
| nim |||| `nimlangserver` |
| nix ||| | `nil`, `nixd` |
Expand Down
14 changes: 14 additions & 0 deletions languages.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3810,3 +3810,17 @@ language-servers = ["circom-lsp"]
[[grammar]]
name = "circom"
source = { git = "https://github.com/Decurity/tree-sitter-circom", rev = "02150524228b1e6afef96949f2d6b7cc0aaf999e" }

[[language]]
name = "nginx"
scope = "source.nginx"
injection-regex = "nginx"
file-types = ["conf"]
roots = []
comment-token = "#"
indent = { tab-width = 4, unit = " " }
auto-format = false

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

(number) @number
(metric) @number

(regex) @regex

(variable) @variable

(modifier) @operator

(simple_directive
name: (directive) @function)

(block_directive
name: (directive) @function)

(lua_block_directive
"access_by_lua_block" @function)

((generic) @constant.builtin
(#match? @constant.builtin "^(off|on)$"))

(generic) @string
(string) @string

(scheme) @string
(ipv4) @number

[
";"
] @delimiter

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

; Lua Debug
(lua_code) @definition.type
4 changes: 4 additions & 0 deletions runtime/queries/nginx/injections.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
; Script tags
((lua_code) @injection.content
(#set! injection.language "lua")
(#set! injection.combined))

0 comments on commit a01338a

Please sign in to comment.