Skip to content

Commit

Permalink
Add Hurl Support (#6450)
Browse files Browse the repository at this point in the history
  • Loading branch information
erasin committed Apr 6, 2023
1 parent 951e868 commit c22ebfe
Show file tree
Hide file tree
Showing 5 changed files with 167 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` |
| hurl || || |
| 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 @@ -2422,3 +2422,17 @@ language-server = { command = "nimlangserver" }
[[grammar]]
name = "nim"
source = { git = "https://github.com/aMOPel/tree-sitter-nim", rev = "240239b232550e431d67de250d1b5856209e7f06" }

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

[[grammar]]
name = "hurl"
source = { git = "https://github.com/pfeiferj/tree-sitter-hurl", rev = "264c42064b61ee21abe88d0061f29a0523352e22" }

127 changes: 127 additions & 0 deletions runtime/queries/hurl/highlights.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
[
"[QueryStringParams]"
"[FormParams]"
"[MultipartFormData]"
"[Cookies]"
"[Captures]"
"[Asserts]"
"[Options]"
"[BasicAuth]"
] @attribute

(comment) @comment

[
(key_string)
(json_key_string)
] @variable.other.member

(value_string) @string
(quoted_string) @string
(json_string) @string
(file_value) @string.special.path
(regex) @string.regex

[
"\\"
(regex_escaped_char)
(quoted_string_escaped_char)
(key_string_escaped_char)
(value_string_escaped_char)
(oneline_string_escaped_char)
(multiline_string_escaped_char)
(filename_escaped_char)
(json_string_escaped_char)
] @constant.character.escape

(method) @type.builtin
(multiline_string_type) @type

[
"status"
"url"
"header"
"cookie"
"body"
"xpath"
"jsonpath"
"regex"
"variable"
"duration"
"sha256"
"md5"
"bytes"
] @function.builtin

(filter) @attribute

(version) @string.special
[
"null"
"cacert"
"location"
"insecure"
"max-redirs"
"retry"
"retry-interval"
"retry-max-count"
(variable_option "variable")
"verbose"
"very-verbose"
] @constant.builtin

(boolean) @constant.builtin.boolean

(variable_name) @variable

[
"not"
"equals"
"=="
"notEquals"
"!="
"greaterThan"
">"
"greaterThanOrEquals"
">="
"lessThan"
"<"
"lessThanOrEquals"
"<="
"startsWith"
"endsWith"
"contains"
"matches"
"exists"
"includes"
"isInteger"
"isFloat"
"isBoolean"
"isString"
"isCollection"
] @keyword.operator

(integer) @constant.numeric.integer
(float) @constant.numeric.float
(status) @constant.numeric
(json_number) @constant.numeric.float

[
":"
","
] @punctuation.delimiter

[
"["
"]"
"{"
"}"
"{{"
"}}"
] @punctuation.special

[
"base64,"
"file,"
"hex,"
] @string.special
11 changes: 11 additions & 0 deletions runtime/queries/hurl/indents.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[
(json_object)
(json_array)
(xml_tag)
] @indent

[
"}"
"]"
(xml_close_tag)
] @outdent
14 changes: 14 additions & 0 deletions runtime/queries/hurl/injections.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
((comment) @injection.content
(#set! injection.language "comment"))

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

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

((multiline_string
(multiline_string_type) @injection.language
(multiline_string_content) @injection.content)
(#set! injection.include-children)
(#set! injection.combined))

0 comments on commit c22ebfe

Please sign in to comment.