aboutsummaryrefslogtreecommitdiffstats
path: root/lua
diff options
context:
space:
mode:
authorThomas Vigouroux <tomvig38@gmail.com>2021-01-12 12:10:01 +0100
committerThomas Vigouroux <tomvig38@gmail.com>2021-01-14 13:26:43 +0100
commit4538a876b4a7ae289e48135ae82b3ea6b59a59dc (patch)
tree2b738197b014352a68e7f816e6364e50ce3338b4 /lua
parentfix(highlight): fix detach function (diff)
downloadnvim-treesitter-4538a876b4a7ae289e48135ae82b3ea6b59a59dc.tar
nvim-treesitter-4538a876b4a7ae289e48135ae82b3ea6b59a59dc.tar.gz
nvim-treesitter-4538a876b4a7ae289e48135ae82b3ea6b59a59dc.tar.bz2
nvim-treesitter-4538a876b4a7ae289e48135ae82b3ea6b59a59dc.tar.lz
nvim-treesitter-4538a876b4a7ae289e48135ae82b3ea6b59a59dc.tar.xz
nvim-treesitter-4538a876b4a7ae289e48135ae82b3ea6b59a59dc.tar.zst
nvim-treesitter-4538a876b4a7ae289e48135ae82b3ea6b59a59dc.zip
Revert "added attach async"
Diffstat (limited to 'lua')
-rw-r--r--lua/nvim-treesitter/configs.lua17
1 files changed, 3 insertions, 14 deletions
diff --git a/lua/nvim-treesitter/configs.lua b/lua/nvim-treesitter/configs.lua
index 7a41aae90..b0d38244e 100644
--- a/lua/nvim-treesitter/configs.lua
+++ b/lua/nvim-treesitter/configs.lua
@@ -78,7 +78,7 @@ local function enable_mod_conf_autocmd(mod)
return
end
- local cmd = string.format("lua require'nvim-treesitter.configs'.attach_module_async('%s')", mod)
+ local cmd = string.format("lua require'nvim-treesitter.configs'.attach_module('%s')", mod)
api.nvim_command(string.format("autocmd NvimTreesitter FileType * %s", cmd))
config_mod.loaded = true
@@ -299,8 +299,8 @@ end
-- @param bufnr the bufnr
-- @param lang the language of the buffer
function M.attach_module(mod_name, bufnr, lang)
- bufnr = bufnr or api.nvim_get_current_buf()
- lang = lang or parsers.get_buf_lang(bufnr)
+ local bufnr = bufnr or api.nvim_get_current_buf()
+ local lang = lang or parsers.get_buf_lang(bufnr)
local resolved_mod = resolve_module(mod_name)
if resolved_mod
@@ -311,17 +311,6 @@ function M.attach_module(mod_name, bufnr, lang)
end
end
--- 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
-- @param mod_name the module name
-- @param bufnr the bufnr