Skip to content

Commit b745bea

Browse files
soifouSaghen
andauthored
fix(fuzzy): check shared lib existence before skipping download (#2055)
* fix(fuzzy): check shared lib existence before skipping download Avoid false positives when the version file exists but the shared library is missing (e.g., due to incomplete build). Notify the user in that case. Closes #2048 * fix(fuzzy): test load via require, update error message --------- Co-authored-by: Liam Dyer <[email protected]>
1 parent e3f28f1 commit b745bea

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

lua/blink/cmp/fuzzy/download/init.lua

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,22 @@ function download.ensure_downloaded(callback)
3030

3131
-- built locally
3232
if version.current.sha ~= nil then
33-
-- up to date or version ignored, ignore
34-
if version.current.sha == version.git.sha or download_config.ignore_version_mismatch then return end
33+
-- check version matches (or explicitly ignored) and shared library exists
34+
if version.current.sha == version.git.sha or download_config.ignore_version_mismatch then
35+
local loaded, err = pcall(require, 'blink.cmp.fuzzy.rust')
36+
if loaded then return end
37+
38+
-- shared library missing despite matching version info (e.g., incomplete build)
39+
utils.notify({
40+
{ 'Incomplete build of the ' },
41+
{ 'fuzzy matching library', 'DiagnosticInfo' },
42+
{ ' detected, please re-run ' },
43+
{ ' cargo build --release ', 'DiagnosticVirtualTextInfo' },
44+
{ ' such as by re-installing. ' },
45+
{ 'Error: ' .. tostring(err), 'DiagnosticError' },
46+
})
47+
return false
48+
end
3549

3650
-- out of date
3751
utils.notify({

0 commit comments

Comments
 (0)