Skip to content

Commit

Permalink
feat: add tree-sitter parser instructions, remove syntax highlighting…
Browse files Browse the repository at this point in the history
… lazy-loading. Closes #30
  • Loading branch information
NTBBloodbath committed Aug 26, 2021
1 parent 440e95d commit 1831a5f
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,24 @@ use {
}
```

### Tree-Sitter parser

We are using a Tree-Sitter parser for our HTTP files, in order to get the correct syntax highlighting
you should add this before your tree-sitter setup.

```lua
local parser_configs = require("nvim-treesitter.parsers").get_parser_configs()
parser_configs.http = {
install_info = {
url = "https://github.com/NTBBloodbath/tree-sitter-http",
files = { "src/parser.c" },
branch = "main",
},
}
```

And then add `"http"` in your `ensure_installed` table or manually run `:TSInstall http`.

## Keybindings

By default `rest.nvim` does not have any key mappings so you will not have
Expand Down
1 change: 1 addition & 0 deletions ftdetect/http.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
au BufRead,BufNewFile *.http set ft=http
4 changes: 0 additions & 4 deletions lua/rest-nvim/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,8 @@ local config = require("rest-nvim.config")
local curl = require("rest-nvim.curl")
local LastOpts = {}

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

-- run will retrieve the required request information from the current buffer
Expand Down

0 comments on commit 1831a5f

Please sign in to comment.