From 6fd708f893d6e55426acda43deef86071aefc2d6 Mon Sep 17 00:00:00 2001 From: Tomas Slusny Date: Sun, 10 Mar 2024 14:09:04 +0100 Subject: [PATCH] feat: Improve healthcheck messages with fix instructions - Also add check for stable >=0.9.5 Signed-off-by: Tomas Slusny --- lua/CopilotChat/health.lua | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/lua/CopilotChat/health.lua b/lua/CopilotChat/health.lua index 70d8aebb..2cd3da60 100644 --- a/lua/CopilotChat/health.lua +++ b/lua/CopilotChat/health.lua @@ -42,24 +42,27 @@ function M.check() start('CopilotChat.nvim [core]') local is_nightly = vim.fn.has('nvim-0.10.0') == 1 + local is_good_stable = vim.fn.has('nvim-0.9.5') == 1 if is_nightly then ok('nvim: nightly') - else + elseif is_good_stable then warn('nvim: stable, some features may not be available') + else + error('nvim: unsupported, please upgrade to 0.9.5 or later') end start('CopilotChat.nvim [commands]') local curl_version = run_command('curl', '--version') if curl_version == false then - error('curl: missing, required for API requests') + error('curl: missing, required for API requests. See "https://curl.se/".') else ok('curl: ' .. curl_version) end local git_version = run_command('git', '--version') if git_version == false then - warn('git: missing, required for git-related commands') + warn('git: missing, required for git-related commands. See "https://git-scm.com/".') else ok('git: ' .. git_version) end @@ -69,7 +72,9 @@ function M.check() if lualib_installed('plenary') then ok('plenary: installed') else - error('plenary: missing, required for running tests. Install plenary.nvim') + error( + 'plenary: missing, required for http requests and async jobs. Install "nvim-lua/plenary.nvim" plugin.' + ) end local has_copilot = lualib_installed('copilot') @@ -78,26 +83,32 @@ function M.check() ok('copilot: ' .. (has_copilot and 'copilot.lua' or 'copilot.vim')) else error( - 'copilot: missing, required for 2 factor authentication. Install copilot.vim or copilot.lua' + 'copilot: missing, required for 2 factor authentication. Install "github/copilot.vim" or "zbirenbaum/copilot.lua" plugins.' ) end if lualib_installed('tiktoken_core') then ok('tiktoken_core: installed') else - warn('tiktoken_core: missing, optional for token counting.') + warn( + 'tiktoken_core: missing, optional for token counting. See README for installation instructions.' + ) end if treesitter_parser_available('markdown') then ok('treesitter[markdown]: installed') else - warn('treesitter[markdown]: missing, optional for better chat highlighting') + warn( + 'treesitter[markdown]: missing, optional for better chat highlighting. Install "nvim-treesitter/nvim-treesitter" plugin and run ":TSInstall markdown".' + ) end if treesitter_parser_available('diff') then ok('treesitter[diff]: installed') else - warn('treesitter[diff]: missing, optional for better diff highlighting') + warn( + 'treesitter[diff]: missing, optional for better diff highlighting. Install "nvim-treesitter/nvim-treesitter" plugin and run ":TSInstall diff".' + ) end end