From e91ff44c0a97a76a004b5516db8e3085d1955fb6 Mon Sep 17 00:00:00 2001 From: William Boman Date: Sat, 11 May 2024 23:21:55 +0200 Subject: chore(registry): clean up recent changes (#1704) --- lua/mason-registry/sources/file.lua | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) (limited to 'lua') diff --git a/lua/mason-registry/sources/file.lua b/lua/mason-registry/sources/file.lua index 2da7d7bc..d21c1f9f 100644 --- a/lua/mason-registry/sources/file.lua +++ b/lua/mason-registry/sources/file.lua @@ -91,24 +91,21 @@ function FileRegistrySource:install() ---@type ReaddirEntry[] local entries = _.filter(_.prop_eq("type", "directory"), fs.async.readdir(packages_dir)) - local streaming_parser - do - streaming_parser = coroutine.wrap(function() - local buffer = "" - while true do - local delim = buffer:find("\n", 1, true) - if delim then - local content = buffer:sub(1, delim - 1) - buffer = buffer:sub(delim + 1) - local chunk = coroutine.yield(content) - buffer = buffer .. chunk - else - local chunk = coroutine.yield() - buffer = buffer .. chunk - end + local streaming_parser = coroutine.wrap(function() + local buffer = "" + while true do + local delim = buffer:find("\n", 1, true) + if delim then + local content = buffer:sub(1, delim - 1) + buffer = buffer:sub(delim + 1) + local chunk = coroutine.yield(content) + buffer = buffer .. chunk + else + local chunk = coroutine.yield() + buffer = buffer .. chunk end - end) - end + end + end) -- Initialize parser coroutine. streaming_parser() @@ -128,7 +125,6 @@ function FileRegistrySource:install() end end - a.scheduler() try(spawn [yq]({ "-I0", -- output one document per line -- cgit v1.2.3-70-g09d2