Skip to content

Commit 1831a5f

Browse files
committed
feat: add tree-sitter parser instructions, remove syntax highlighting lazy-loading. Closes #30
1 parent 440e95d commit 1831a5f

File tree

3 files changed

+19
-4
lines changed

3 files changed

+19
-4
lines changed

README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,24 @@ use {
6464
}
6565
```
6666

67+
### Tree-Sitter parser
68+
69+
We are using a Tree-Sitter parser for our HTTP files, in order to get the correct syntax highlighting
70+
you should add this before your tree-sitter setup.
71+
72+
```lua
73+
local parser_configs = require("nvim-treesitter.parsers").get_parser_configs()
74+
parser_configs.http = {
75+
install_info = {
76+
url = "https://github.com/NTBBloodbath/tree-sitter-http",
77+
files = { "src/parser.c" },
78+
branch = "main",
79+
},
80+
}
81+
```
82+
83+
And then add `"http"` in your `ensure_installed` table or manually run `:TSInstall http`.
84+
6785
## Keybindings
6886

6987
By default `rest.nvim` does not have any key mappings so you will not have

ftdetect/http.vim

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
au BufRead,BufNewFile *.http set ft=http

lua/rest-nvim/init.lua

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,8 @@ local config = require("rest-nvim.config")
44
local curl = require("rest-nvim.curl")
55
local LastOpts = {}
66

7-
-- setup is needed for enabling syntax highlighting for http files
87
rest.setup = function(user_configs)
98
config.set(user_configs or {})
10-
if vim.fn.expand("%:e") == "http" then
11-
vim.api.nvim_buf_set_option("%", "filetype", "http")
12-
end
139
end
1410

1511
-- run will retrieve the required request information from the current buffer

0 commit comments

Comments
 (0)