diff options
| author | Alejandro <bloodbathalchemist@protonmail.com> | 2024-08-21 03:08:45 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-08-21 09:08:45 +0200 |
| commit | 0fd6d324828952eaa4596d0d3d8043acc401bc05 (patch) | |
| tree | b321b7de573fdb73ed6012f2842d41f4faba7806 /queries/http | |
| parent | Revert "ci: skip updates for javascript" (diff) | |
| download | nvim-treesitter-0fd6d324828952eaa4596d0d3d8043acc401bc05.tar nvim-treesitter-0fd6d324828952eaa4596d0d3d8043acc401bc05.tar.gz nvim-treesitter-0fd6d324828952eaa4596d0d3d8043acc401bc05.tar.bz2 nvim-treesitter-0fd6d324828952eaa4596d0d3d8043acc401bc05.tar.lz nvim-treesitter-0fd6d324828952eaa4596d0d3d8043acc401bc05.tar.xz nvim-treesitter-0fd6d324828952eaa4596d0d3d8043acc401bc05.tar.zst nvim-treesitter-0fd6d324828952eaa4596d0d3d8043acc401bc05.zip | |
feat(http): switch to new parser version (#7063)
Diffstat (limited to 'queries/http')
| -rw-r--r-- | queries/http/highlights.scm | 54 | ||||
| -rw-r--r-- | queries/http/injections.scm | 19 |
2 files changed, 37 insertions, 36 deletions
diff --git a/queries/http/highlights.scm b/queries/http/highlights.scm index efa77d27e..76d62778c 100644 --- a/queries/http/highlights.scm +++ b/queries/http/highlights.scm @@ -1,50 +1,36 @@ -; Keywords -(scheme) @module - ; Methods (method) @function.method ; Headers (header - name: (name) @constant) + name: (_) @constant) ; Variables (variable_declaration name: (identifier) @variable) -; Fields -(pair - name: (identifier) @variable.member) - -; URL / Host -(host) @string.special.url - -(path - (identifier) @string.special.url) +; Operators +(comment + "=" @operator) -; Parameters -(query_param - (key) @variable.parameter) +(variable_declaration + "=" @operator) -; Operators -[ - "=" - "?" - "&" - "@" - "<" -] @operator +; keywords +(comment + "@" @keyword + name: (_) @keyword) ; Literals -(target_url) @string.special.url +(request + url: (_) @string.special.url) (http_version) @constant -(string) @string - -(number) @number +; Response +(status_code) @number -(boolean) @boolean +(status_text) @string ; Punctuation [ @@ -52,11 +38,15 @@ "}}" ] @punctuation.bracket -":" @punctuation.delimiter +(header + ":" @punctuation.delimiter) ; external JSON body (external_body - file_path: (path) @string.special.path) + path: (_) @string.special.path) ; Comments -(comment) @comment @spell +[ + (comment) + (request_separator) +] @comment @spell diff --git a/queries/http/injections.scm b/queries/http/injections.scm index 68268afcb..0eebd0fae 100644 --- a/queries/http/injections.scm +++ b/queries/http/injections.scm @@ -9,9 +9,20 @@ ((xml_body) @injection.content (#set! injection.language "xml")) -((graphql_body) @injection.content +((graphql_data) @injection.content (#set! injection.language "graphql")) -; Lua scripting -((script_variable) @injection.content - (#set! injection.language "lua")) +; Script (default to javascript) +((script) @injection.content + (#offset! @injection.content 0 2 0 -2) + (#set! injection.language "javascript")) + +; Script with other languages +((comment + name: (_) @_name + (#eq? @_name "lang") + value: (_) @injection.language) + . + (_ + (script) @injection.content + (#offset! @injection.content 0 2 0 -2))) |
