summaryrefslogtreecommitdiff
path: root/runtime/queries
diff options
context:
space:
mode:
authorErasin Wang2023-04-06 16:26:41 +0000
committerGitHub2023-04-06 16:26:41 +0000
commitc22ebfe62ed0404a0f7328e3a5100c971f864004 (patch)
treee7bd1ae0284a32a698dafa3534a31b1f205b596f /runtime/queries
parent951e8686e8182ca9a914ea8ea864c7234349d391 (diff)
Add Hurl Support (#6450)
* Add http Support It's like [vscode-restclient](https://github.com/Huachao/vscode-restclient) - https://github.com/erasin/tree-sitter-http/tree/main/tests * Add Hurl Support
Diffstat (limited to 'runtime/queries')
-rw-r--r--runtime/queries/hurl/highlights.scm127
-rw-r--r--runtime/queries/hurl/indents.scm11
-rw-r--r--runtime/queries/hurl/injections.scm14
3 files changed, 152 insertions, 0 deletions
diff --git a/runtime/queries/hurl/highlights.scm b/runtime/queries/hurl/highlights.scm
new file mode 100644
index 00000000..c066b284
--- /dev/null
+++ b/runtime/queries/hurl/highlights.scm
@@ -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 \ No newline at end of file
diff --git a/runtime/queries/hurl/indents.scm b/runtime/queries/hurl/indents.scm
new file mode 100644
index 00000000..d436f76f
--- /dev/null
+++ b/runtime/queries/hurl/indents.scm
@@ -0,0 +1,11 @@
+[
+ (json_object)
+ (json_array)
+ (xml_tag)
+] @indent
+
+[
+ "}"
+ "]"
+ (xml_close_tag)
+] @outdent
diff --git a/runtime/queries/hurl/injections.scm b/runtime/queries/hurl/injections.scm
new file mode 100644
index 00000000..a0d23817
--- /dev/null
+++ b/runtime/queries/hurl/injections.scm
@@ -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))