From a93c5b80d724f40da649f7e351234531e0e9fcb2 Mon Sep 17 00:00:00 2001 From: gegoune Date: Thu, 4 Nov 2021 13:56:26 +0200 Subject: feat: add http parser All credit goes to @NTBBloodbath. See: https://github.com/NTBBloodbath/rest.nvim/issues/75#issuecomment-960447966 Co-authored-by: NTBBloodbath --- lua/nvim-treesitter/parsers.lua | 9 +++++++++ queries/http/highlights.scm | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 queries/http/highlights.scm diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index 71ca152e0..44ef78ed9 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -762,6 +762,15 @@ list.llvm = { maintainers = { "@benwilliamgraham" }, } +list.http = { + install_info = { + url = "https://github.com/NTBBloodbath/tree-sitter-http", + branch = "main", + files = { "src/parser.c" }, + }, + maintainers = { "@NTBBloodbath" }, +} + local M = { list = list, } diff --git a/queries/http/highlights.scm b/queries/http/highlights.scm new file mode 100644 index 000000000..c1fc5b9cd --- /dev/null +++ b/queries/http/highlights.scm @@ -0,0 +1,33 @@ +; Display errors +(ERROR) @error + +; Comments +(comment) @comment + +(request + method: (method) @keyword + url: (url) @TSURI) + +(header + name: (name) @constant + value: (value)) + +; JSON +(json_pair + key: (_) @keyword) + +(json_string) @string + +(json_number) @number + +(json_boolean) @boolean + +(json_null) @constant + +(json_escape_sequence) @TSStringEscape + +(json_body) @keyword + +; rest.nvim Neovim plugin specific features +(external_body + json_file: (json_file) @TSURI) @keyword -- cgit v1.2.3-70-g09d2