Skip to content

Commit

Permalink
fix: bug when loading the lualine component
Browse files Browse the repository at this point in the history
  • Loading branch information
rstcruzo committed Nov 21, 2024
1 parent d7d5ece commit cb0c146
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 25 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Install the plugin with your preferred plugin manager:

> [!NOTE]
>
> http.nvim uses a Tree-sitter grammar that is not yet included in nvim-treesitter. `setup()` replaces the default `http` grammar with [this](https://github.com/rstcruzo/tree-sitter-http2) one. This grammar provides features that aren't available in the default grammar.
> http.nvim uses a Tree-sitter grammar that is not yet included in nvim-treesitter. When loading this plugin the default `http` grammar is replaced with [this](https://github.com/rstcruzo/tree-sitter-http2) one. This grammar provides features that aren't available in the default grammar.
> [!NOTE]
>
Expand Down
2 changes: 1 addition & 1 deletion doc/http.nvim.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Install the plugin with your preferred plugin manager:
}
<

Note: http.nvim uses a Tree-sitter grammar that is not yet included in nvim-treesitter. `setup()` replaces the default `http` grammar with this: <https://github.com/rstcruzo/tree-sitter-http2>. This grammar provides features that aren't available in the default grammar.
Note: http.nvim uses a Tree-sitter grammar that is not yet included in nvim-treesitter. When loading this plugin the default `http` grammar is replaced with this: <https://github.com/rstcruzo/tree-sitter-http2>. This grammar provides features that aren't available in the default grammar.

CONFIGURATION *http.nvim-configuration*

Expand Down
23 changes: 0 additions & 23 deletions lua/http-nvim/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -291,29 +291,6 @@ vim.api.nvim_create_user_command("Http", http_cmd, {

local M = {}

M.init = function()
local parser_config =
require("nvim-treesitter.parsers").get_parser_configs()
parser_config.http2 = {
install_info = {
url = "https://github.com/rstcruzo/tree-sitter-http2",
branch = "main",
files = { "src/parser.c" },
},
filetype = "http",
}

vim.treesitter.language.register("http2", "http")

vim.filetype.add({
extension = {
http = "http",
},
})
end

M.init()

---@param opts? http.Opts
M.setup = function(opts)
config.setup(opts)
Expand Down
24 changes: 24 additions & 0 deletions lua/http-nvim/queries.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,29 @@
local M = {}

local function init_parser()
local parser_config =
require("nvim-treesitter.parsers").get_parser_configs()
parser_config.http2 = {
install_info = {
url = "https://github.com/rstcruzo/tree-sitter-http2",
branch = "main",
files = { "src/parser.c" },
},
filetype = "http",
}

vim.treesitter.language.register("http2", "http")

vim.filetype.add({
extension = {
http = "http",
},
})
end

-- Initializing the parser here to avoid errors when using any of these queries.
init_parser()

-- TODO: Change parser name from http2 to something else.
M.requests_query = vim.treesitter.query.parse(
"http2",
Expand Down

0 comments on commit cb0c146

Please sign in to comment.