-
Notifications
You must be signed in to change notification settings - Fork 196
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add health.lua and basic healthchecks (#101)
- Loading branch information
1 parent
b378d50
commit a12617d
Showing
2 changed files
with
42 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
local M = {} | ||
local download = require('blink.cmp.fuzzy.download') | ||
|
||
M.check = function() | ||
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 system_triple = download.get_system_triple() | ||
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 | ||
|
||
if | ||
vim.uv.fs_stat(download.lib_path) | ||
or vim.uv.fs_stat(string.gsub(download.lib_path, 'libblink_cmp_fuzzy', 'blink_cmp_fuzzy')) | ||
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 M |