From 0c5b6ca6b694c2f5f97a1d3f470643329c5c52db Mon Sep 17 00:00:00 2001 From: Mat Jones Date: Sun, 31 Oct 2021 19:35:34 -0400 Subject: [PATCH] Update healthcheck to reflect new fzf-lua support --- lua/dash/health.lua | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/lua/dash/health.lua b/lua/dash/health.lua index e7db13c..650a611 100644 --- a/lua/dash/health.lua +++ b/lua/dash/health.lua @@ -13,6 +13,25 @@ local function get_keys(tbl) return keyset end +local function check_fuzzy_finder() + local health_ok = vim.fn['health#report_ok'] + local health_error = vim.fn['health#report_error'] + + local telescope_ok, _ = pcall(require, 'telescope') + if telescope_ok then + health_ok("Fuzzy finder plugin 'telescope' is installed.") + end + + local fzf_lua_ok, _ = pcall(require, 'fzf-lua') + if fzf_lua_ok then + health_ok("Fuzzy finder plugin 'fzf-lua' is installed.") + end + + if not telescope_ok and not fzf_lua_ok then + health_error('No supported fuzzy finder plugins are installed.') + end +end + function M.check() -- health_start begins a new section local health_start = vim.fn['health#report_start'] @@ -21,21 +40,8 @@ function M.check() local health_info = vim.fn['health#report_info'] health_start('Dependencies') - -- check whether we can require('telescope') successfully - local telescope_ok, _ = pcall(require, 'telescope') - if not telescope_ok then - health_error("Module 'telescope' not found.") - else - health_ok("Module 'telescope' installed.") - end - - -- check whether we can require('plenary') successfully - local plenary_ok, _ = pcall(require, 'plenary') - if not plenary_ok then - health_error("Module 'plenary' not found.") - else - health_ok("Module 'plenary' installed.") - end + -- check whether we can require one of the supported fuzzy-finders successfully successfully + check_fuzzy_finder() -- ensure config is setup require('telescope').load_extension('dash')