diff options
| author | Brian Shu <littlebubu.shu@gmail.com> | 2021-01-05 11:26:03 -0500 |
|---|---|---|
| committer | Thomas Vigouroux <tomvig38@gmail.com> | 2021-01-07 11:16:16 +0100 |
| commit | e0b49a9a1885708d3565e9a59847b14a42faef2c (patch) | |
| tree | 949c280d7de6cad86a44ffdebca698d57ff9d169 /lua/nvim-treesitter/utils.lua | |
| parent | b441f257a40565d8f26a870d82b32ec87286b2d0 (diff) | |
added attach async
Diffstat (limited to 'lua/nvim-treesitter/utils.lua')
| -rw-r--r-- | lua/nvim-treesitter/utils.lua | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lua/nvim-treesitter/utils.lua b/lua/nvim-treesitter/utils.lua index de579bd6..00ba4b94 100644 --- a/lua/nvim-treesitter/utils.lua +++ b/lua/nvim-treesitter/utils.lua @@ -141,4 +141,15 @@ function M.index_of(tbl, obj) 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 |
