Skip to content

Commit

Permalink
Add http Support
Browse files Browse the repository at this point in the history
  • Loading branch information
erasin committed Mar 27, 2023
1 parent 2af14a2 commit 06016bd
Show file tree
Hide file tree
Showing 4 changed files with 66 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 @@ -59,6 +59,7 @@
| heex ||| | `elixir-ls` |
| hosts || | | |
| html || | | `vscode-html-language-server` |
| http || | | |
| idris | | | | `idris2-lsp` |
| iex || | | |
| ini || | | |
Expand Down
14 changes: 14 additions & 0 deletions languages.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2421,3 +2421,17 @@ language-server = { command = "nimlangserver" }
[[grammar]]
name = "nim"
source = { git = "https://github.com/aMOPel/tree-sitter-nim", rev = "240239b232550e431d67de250d1b5856209e7f06" }

[[language]]
name = "http"
scope = "source.http"
injection-regex = "http"
file-types = ["http"]
roots = []
comment-token = "#"
indent = { tab-width = 2, unit = " " }

[[grammar]]
name = "http"
source = { git = "https://github.com/erasin/tree-sitter-http", rev = "3dc1385ab2d4ce97eb583ced6e962fff8f407830" }

43 changes: 43 additions & 0 deletions runtime/queries/http/highlights.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
; Comments
(comment) @comment

(method) @keyword

(target_url) @string.special.url
(host) @string.special.url
(path) @string.special.path
(scheme) @keyword

(http_version) @keyword

(authority
(pair
name: (_) @info
value: (_) @warning))

(pair
name: (_) @attribute
value: (_) @string)

(query_param
key: (key) @attribute
value: (value) @string)

(header
name: (name) @constant
value: (value) @string)

(external_body
file_path: (path) @string.special.path) @keyword

(number) @constant.numeric
(string) @string
(variable) @variable.other.member
(variable_declaration
identifier: (identifier) @variable)

[
"@"
":"
"="
] @operator
8 changes: 8 additions & 0 deletions runtime/queries/http/injections.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
((comment) @injection.content
(#set! injection.language "comment"))

((json_body) @injection.content
(#set! injection.language "json"))

((xml_body) @injection.content
(#set! injection.language "xml"))

0 comments on commit 06016bd

Please sign in to comment.