diff options
| author | Lewis Russell <lewis6991@gmail.com> | 2023-08-22 12:23:55 +0100 |
|---|---|---|
| committer | Lewis Russell <lewis6991@gmail.com> | 2023-08-22 13:22:08 +0100 |
| commit | 875d7e84d01f834f336a33a54673151819bea415 (patch) | |
| tree | 4cba843a743afba50fc7d1548c8860dbb2661be0 /lua/lspconfig/util.lua | |
| parent | refactor: add sanitize_cmd() (diff) | |
| download | nvim-lspconfig-875d7e84d01f834f336a33a54673151819bea415.tar nvim-lspconfig-875d7e84d01f834f336a33a54673151819bea415.tar.gz nvim-lspconfig-875d7e84d01f834f336a33a54673151819bea415.tar.bz2 nvim-lspconfig-875d7e84d01f834f336a33a54673151819bea415.tar.lz nvim-lspconfig-875d7e84d01f834f336a33a54673151819bea415.tar.xz nvim-lspconfig-875d7e84d01f834f336a33a54673151819bea415.tar.zst nvim-lspconfig-875d7e84d01f834f336a33a54673151819bea415.zip | |
refactor: move async_run_command()
Diffstat (limited to 'lua/lspconfig/util.lua')
| -rw-r--r-- | lua/lspconfig/util.lua | 34 |
1 files changed, 0 insertions, 34 deletions
diff --git a/lua/lspconfig/util.lua b/lua/lspconfig/util.lua index 2233f7ac..98f9a323 100644 --- a/lua/lspconfig/util.lua +++ b/lua/lspconfig/util.lua @@ -401,38 +401,4 @@ function M.strip_archive_subpath(path) return path end -function M.async_run_command(cmd) - local co = assert(coroutine.running()) - - local stdout = {} - local stderr = {} - local jobid = vim.fn.jobstart(cmd, { - on_stdout = function(_, data, _) - data = table.concat(data, '\n') - if #data > 0 then - stdout[#stdout + 1] = data - end - end, - on_stderr = function(_, data, _) - stderr[#stderr + 1] = table.concat(data, '\n') - end, - on_exit = function() - coroutine.resume(co) - end, - stdout_buffered = true, - stderr_buffered = true, - }) - - if jobid <= 0 then - vim.notify(('[lspconfig] cmd go failed:\n%s'):format(table.concat(stderr, '')), vim.log.levels.WARN) - return - end - - coroutine.yield() - if next(stdout) == nil then - return nil - end - return stdout and stdout or nil -end - return M |
