perf: async cache initialization and remove deepcopy (#8)

* perf: async cache initialization and remove deepcopy

Problem: first completion request blocked the UI with a synchronous
vim.system():wait() call, and every subsequent key completion
unnecessarily deep-copied the entire cache.

Solution: use vim.system with an async callback to initialize the cache
without blocking. Queue pending completion requests during loading and
serve them once parsing finishes. Return cached keys directly instead
of deep-copying.

* fix: revert blanket diagnostics.disable and selene comments

Problem: .luarc.json blanket-disabled four diagnostic categories
project-wide, and selene inline directives were added to suppress
warnings on io.open monkey-patching in tests.

Solution: revert .luarc.json to match main and remove selene comments.
This commit is contained in:
Barrett Ruth 2026-02-20 21:01:21 -05:00 committed by GitHub
parent b5b18520d7
commit 072859ce04
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 56 additions and 15 deletions

View file

@ -19,24 +19,39 @@ local BASH_COMPLETION = table.concat({
}, '\n')
local function mock_system()
local original = vim.system
local original_system = vim.system
local original_schedule = vim.schedule
---@diagnostic disable-next-line: duplicate-set-field
vim.system = function(cmd)
vim.system = function(cmd, _, on_exit)
if cmd[1] == 'ghostty' then
local result = { stdout = CONFIG_DOCS, code = 0 }
if on_exit then
on_exit(result)
return {}
end
return {
wait = function()
return { stdout = CONFIG_DOCS, code = 0 }
return result
end,
}
end
local result = { stdout = '', code = 1 }
if on_exit then
on_exit(result)
return {}
end
return {
wait = function()
return { stdout = '', code = 1 }
return result
end,
}
end
vim.schedule = function(fn)
fn()
end
return function()
vim.system = original
vim.system = original_system
vim.schedule = original_schedule
end
end