summaryrefslogtreecommitdiff
path: root/lua/blink/cmp/health.lua
diff options
context:
space:
mode:
authorMike Vink <mike@pionative.com>2025-01-19 13:52:52 +0100
committerMike Vink <mike@pionative.com>2025-01-19 13:52:52 +0100
commitb77413ff8f59f380612074f0c9bd49093d8db695 (patch)
tree32c39a811ba96ed4ab0a1c81cce9f8d518ed7e31 /lua/blink/cmp/health.lua
Squashed 'mut/neovim/pack/plugins/start/blink.cmp/' content from commit 1cc3b1a
git-subtree-dir: mut/neovim/pack/plugins/start/blink.cmp git-subtree-split: 1cc3b1a908fbcfd15451c4772759549724f38524
Diffstat (limited to 'lua/blink/cmp/health.lua')
-rw-r--r--lua/blink/cmp/health.lua35
1 files changed, 35 insertions, 0 deletions
diff --git a/lua/blink/cmp/health.lua b/lua/blink/cmp/health.lua
new file mode 100644
index 0000000..d8ff4a1
--- /dev/null
+++ b/lua/blink/cmp/health.lua
@@ -0,0 +1,35 @@
+local health = {}
+
+function health.check()
+ vim.health.start('blink.cmp healthcheck')
+
+ local required_executables = { 'curl', 'git' }
+ for _, executable in ipairs(required_executables) do
+ if vim.fn.executable(executable) == 0 then
+ vim.health.error(executable .. ' is not installed')
+ else
+ vim.health.ok(executable .. ' is installed')
+ end
+ end
+
+ -- check if os is supported
+ local download_system = require('blink.cmp.fuzzy.download.system')
+ local system_triple = download_system.get_triple_sync()
+ if system_triple then
+ vim.health.ok('Your system is supported by pre-built binaries (' .. system_triple .. ')')
+ else
+ vim.health.warn(
+ 'Your system is not supported by pre-built binaries. You must run cargo build --release via your package manager with rust nightly. See the README for more info.'
+ )
+ end
+
+ local download_files = require('blink.cmp.fuzzy.download.files')
+ local lib_path_without_prefix = string.gsub(download_files.lib_path, 'libblink_cmp_fuzzy', 'blink_cmp_fuzzy')
+ if vim.uv.fs_stat(download_files.lib_path) or vim.uv.fs_stat(lib_path_without_prefix) then
+ vim.health.ok('blink_cmp_fuzzy lib is downloaded/built')
+ else
+ vim.health.warn('blink_cmp_fuzzy lib is not downloaded/built')
+ end
+end
+
+return health