From e3d8d3f9f04a2e48f192c396d6734ee2b94659d9 Mon Sep 17 00:00:00 2001 From: Asiel Cabrera Date: Sun, 10 May 2026 21:06:55 -0400 Subject: [PATCH] fix(lsp): add timeout to xcrun call in find_sourcekit_lsp xcrun without a timeout can hang checkhealth for 5-10s on macOS when the Xcode Developer Directory cache is cold. Adds a 3s timeout. --- lua/swift/features/lsp.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/swift/features/lsp.lua b/lua/swift/features/lsp.lua index cfc908e..fac0ec5 100644 --- a/lua/swift/features/lsp.lua +++ b/lua/swift/features/lsp.lua @@ -38,7 +38,7 @@ function M.find_sourcekit_lsp() -- Try Xcode toolchain if vim.fn.has("mac") == 1 then - local xcrun_path = vim.system({ "xcrun", "--find", "sourcekit-lsp" }, { text = true }):wait().stdout or "" + local xcrun_path = vim.system({ "xcrun", "--find", "sourcekit-lsp" }, { text = true, timeout = 3000 }):wait().stdout or "" xcrun_path = xcrun_path:gsub("\n", "") if xcrun_path ~= "" and vim.fn.executable(xcrun_path) == 1 then table.insert(possible_paths, 1, xcrun_path)