mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-01 19:17:02 -04:00
feat(http): more comprehensive highlights
This commit is contained in:
parent
eff88f4e8b
commit
2d5c122af9
3 changed files with 68 additions and 2 deletions
|
|
@ -5,9 +5,17 @@
|
||||||
(header
|
(header
|
||||||
name: (_) @constant)
|
name: (_) @constant)
|
||||||
|
|
||||||
|
(header
|
||||||
|
value: (_) @string)
|
||||||
|
|
||||||
; Variables
|
; Variables
|
||||||
|
(identifier) @variable
|
||||||
|
|
||||||
(variable_declaration
|
(variable_declaration
|
||||||
name: (identifier) @variable)
|
"@" @character.special)
|
||||||
|
|
||||||
|
(variable_declaration
|
||||||
|
(value) @string)
|
||||||
|
|
||||||
; Operators
|
; Operators
|
||||||
(comment
|
(comment
|
||||||
|
|
@ -25,7 +33,7 @@
|
||||||
(request
|
(request
|
||||||
url: (_) @string.special.url)
|
url: (_) @string.special.url)
|
||||||
|
|
||||||
(http_version) @constant
|
(http_version) @string.special
|
||||||
|
|
||||||
; Response
|
; Response
|
||||||
(status_code) @number
|
(status_code) @number
|
||||||
|
|
@ -36,8 +44,12 @@
|
||||||
[
|
[
|
||||||
"{{"
|
"{{"
|
||||||
"}}"
|
"}}"
|
||||||
|
"{%"
|
||||||
|
"%}"
|
||||||
] @punctuation.bracket
|
] @punctuation.bracket
|
||||||
|
|
||||||
|
">" @punctuation.special
|
||||||
|
|
||||||
(header
|
(header
|
||||||
":" @punctuation.delimiter)
|
":" @punctuation.delimiter)
|
||||||
|
|
||||||
|
|
|
||||||
33
tests/query/highlights/http/test.http
Normal file
33
tests/query/highlights/http/test.http
Normal file
|
|
@ -0,0 +1,33 @@
|
||||||
|
@ENDPOINT=http://localhost:8080/api
|
||||||
|
# <- @character.special
|
||||||
|
# ^^^^^^^ @variable
|
||||||
|
# ^ @operator
|
||||||
|
# ^^^^^^^^^^^^^^^^^^^^^^^^^ @string
|
||||||
|
|
||||||
|
### GET USERS
|
||||||
|
GET {{ENDPOINT}}/users HTTP/1.1
|
||||||
|
# ^^ @punctuation.bracket
|
||||||
|
# ^^^^^^^^ @variable
|
||||||
|
# ^^ @punctuation.bracket
|
||||||
|
# ^^^^^^ @string.special.url
|
||||||
|
# ^^^^^^^^ @string.special
|
||||||
|
|
||||||
|
### GET USERS by Offset
|
||||||
|
GET {{ENDPOINT}}/users?offset=30 HTTP/1.1
|
||||||
|
# <- @function.method
|
||||||
|
|
||||||
|
### POST login
|
||||||
|
POST {{ENDPOINT}}/auth/login HTTP/1.1
|
||||||
|
Content-Type: application/json
|
||||||
|
|
||||||
|
{
|
||||||
|
"username": "admin",
|
||||||
|
"password": "password"
|
||||||
|
}
|
||||||
|
|
||||||
|
### Log Out
|
||||||
|
POST {{ENDPOINT}}/auth/logout HTTP/1.1
|
||||||
|
Content-Type: application/json
|
||||||
|
# ^^^^^^^^^^ @constant
|
||||||
|
# ^ @punctuation.delimiter
|
||||||
|
# vim: ft=http
|
||||||
21
tests/query/injections/http/injections.http
Normal file
21
tests/query/injections/http/injections.http
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
### post-request script
|
||||||
|
GET https://jsonplaceholder.typicode.com/posts/3
|
||||||
|
|
||||||
|
# @lang=lua
|
||||||
|
> {%
|
||||||
|
local body = vim.json.decode(response.body)
|
||||||
|
client.global.set("postId", body.id)
|
||||||
|
-- ^ @lua
|
||||||
|
%}
|
||||||
|
|
||||||
|
|
||||||
|
### run request with variable
|
||||||
|
|
||||||
|
GET https://jsonplaceholder.typicode.com/posts/{{postId}}
|
||||||
|
|
||||||
|
> {%
|
||||||
|
client.global.set("auth_token", response.body.jwt);
|
||||||
|
// ^ @javascript
|
||||||
|
%}
|
||||||
|
|
||||||
|
### vim: ft=http
|
||||||
Loading…
Add table
Add a link
Reference in a new issue