mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-16 18:30:06 -04:00
fixed not highlighting bug
This commit is contained in:
parent
6856e23171
commit
28f2ba475f
2 changed files with 12 additions and 14 deletions
|
|
@ -299,8 +299,8 @@ end
|
||||||
-- @param bufnr the bufnr
|
-- @param bufnr the bufnr
|
||||||
-- @param lang the language of the buffer
|
-- @param lang the language of the buffer
|
||||||
function M.attach_module(mod_name, bufnr, lang)
|
function M.attach_module(mod_name, bufnr, lang)
|
||||||
local bufnr = bufnr or api.nvim_get_current_buf()
|
bufnr = bufnr or api.nvim_get_current_buf()
|
||||||
local lang = lang or parsers.get_buf_lang(bufnr)
|
lang = lang or parsers.get_buf_lang(bufnr)
|
||||||
local resolved_mod = resolve_module(mod_name)
|
local resolved_mod = resolve_module(mod_name)
|
||||||
|
|
||||||
if resolved_mod
|
if resolved_mod
|
||||||
|
|
@ -311,7 +311,16 @@ function M.attach_module(mod_name, bufnr, lang)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
M.attach_module_async = utils.async(M.attach_module)
|
-- must have custom async function or bufnr will be wrong
|
||||||
|
function M.attach_module_async(mod_name, bufnr)
|
||||||
|
bufnr = bufnr or api.nvim_get_current_buf() -- get bufnr before doing async, or bufnr will be wrong
|
||||||
|
|
||||||
|
local handle
|
||||||
|
handle = vim.loop.new_async(vim.schedule_wrap(function(...)
|
||||||
|
M.attach_module(...)
|
||||||
|
end))
|
||||||
|
handle:send(mod_name, bufnr, nil)
|
||||||
|
end
|
||||||
|
|
||||||
-- Detaches a module to a buffer
|
-- Detaches a module to a buffer
|
||||||
-- @param mod_name the module name
|
-- @param mod_name the module name
|
||||||
|
|
|
||||||
|
|
@ -141,15 +141,4 @@ function M.index_of(tbl, obj)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.async(f)
|
|
||||||
return function(...)
|
|
||||||
local handle
|
|
||||||
handle = vim.loop.new_async(vim.schedule_wrap(function(...)
|
|
||||||
f(...)
|
|
||||||
handle:close()
|
|
||||||
end))
|
|
||||||
handle:send(...)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue