From 9dd112dd4821a325a6c1c8d952a537f42f9c728c Mon Sep 17 00:00:00 2001 From: dundargoc Date: Tue, 2 Apr 2024 12:36:13 +0200 Subject: refactor: remove fn_bool It's better to use vim.fn directly instead of creating minor abstractions like fn_bool. --- runtime/lua/provider/ruby/health.lua | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'runtime/lua/provider/ruby') diff --git a/runtime/lua/provider/ruby/health.lua b/runtime/lua/provider/ruby/health.lua index 04f6e303e6..4d859597a4 100644 --- a/runtime/lua/provider/ruby/health.lua +++ b/runtime/lua/provider/ruby/health.lua @@ -1,5 +1,4 @@ local health = vim.health -local executable = health.executable local iswin = vim.loop.os_uname().sysname == 'Windows_NT' local M = {} @@ -11,7 +10,7 @@ function M.check() return end - if not executable('ruby') or not executable('gem') then + if vim.fn.executable('ruby') == 0 or vim.fn.executable('gem') == 0 then health.warn( '`ruby` and `gem` must be in $PATH.', 'Install Ruby and verify that `ruby` and `gem` commands work.' -- cgit From 10f917351906ca2d3c61a6b9bd8b8ae88a26ed8f Mon Sep 17 00:00:00 2001 From: MoonFruit Date: Fri, 17 May 2024 18:25:28 +0800 Subject: fix(health): broken ruby detect #28804 --- runtime/lua/provider/ruby/health.lua | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'runtime/lua/provider/ruby') diff --git a/runtime/lua/provider/ruby/health.lua b/runtime/lua/provider/ruby/health.lua index 4d859597a4..31c2fe3201 100644 --- a/runtime/lua/provider/ruby/health.lua +++ b/runtime/lua/provider/ruby/health.lua @@ -19,8 +19,7 @@ function M.check() end health.info('Ruby: ' .. health.system({ 'ruby', '-v' })) - local ruby_detect_table = vim.provider.ruby.detect() - local host = ruby_detect_table[1] + local host, _ = vim.provider.ruby.detect() if (not host) or host:find('^%s*$') then health.warn('`neovim-ruby-host` not found.', { 'Run `gem install neovim` to ensure the neovim RubyGem is installed.', -- cgit From 0f4f7d32ce5d6d3b751b0b01455770f3b72531b9 Mon Sep 17 00:00:00 2001 From: dundargoc Date: Sat, 18 May 2024 18:35:26 +0200 Subject: refactor!: remove `nvim` and `provider` module for checkhealth The namespacing for healthchecks for neovim modules is inconsistent and confusing. The completion for `:checkhealth` with `--clean` gives ``` nvim provider.clipboard provider.node provider.perl provider.python provider.ruby vim.lsp vim.treesitter ``` There are now three top-level module names for nvim: `nvim`, `provider` and `vim` with no signs of stopping. The `nvim` name is especially confusing as it does not contain all neovim checkhealths, which makes it almost a decoy healthcheck. The confusion only worsens if you add plugins to the mix: ``` lazy mason nvim nvim-treesitter provider.clipboard provider.node provider.perl provider.python provider.ruby telescope vim.lsp vim.treesitter ``` Another problem with the current approach is that it's not easy to run nvim-only healthchecks since they don't share the same namespace. The current approach would be to run `:che nvim vim.* provider.*` and would also require the user to know these are the neovim modules. Instead, use this alternative structure: ``` vim.health vim.lsp vim.provider.clipboard vim.provider.node vim.provider.perl vim.provider.python vim.provider.ruby vim.treesitter ``` and ``` lazy mason nvim-treesitter telescope vim.health vim.lsp vim.provider.clipboard vim.provider.node vim.provider.perl vim.provider.python vim.provider.ruby vim.treesitter ``` Now, the entries are properly sorted and running nvim-only healthchecks requires running only `:che vim.*`. --- runtime/lua/provider/ruby/health.lua | 69 ------------------------------------ 1 file changed, 69 deletions(-) delete mode 100644 runtime/lua/provider/ruby/health.lua (limited to 'runtime/lua/provider/ruby') diff --git a/runtime/lua/provider/ruby/health.lua b/runtime/lua/provider/ruby/health.lua deleted file mode 100644 index 31c2fe3201..0000000000 --- a/runtime/lua/provider/ruby/health.lua +++ /dev/null @@ -1,69 +0,0 @@ -local health = vim.health -local iswin = vim.loop.os_uname().sysname == 'Windows_NT' - -local M = {} - -function M.check() - health.start('Ruby provider (optional)') - - if health.provider_disabled('ruby') then - return - end - - if vim.fn.executable('ruby') == 0 or vim.fn.executable('gem') == 0 then - health.warn( - '`ruby` and `gem` must be in $PATH.', - 'Install Ruby and verify that `ruby` and `gem` commands work.' - ) - return - end - health.info('Ruby: ' .. health.system({ 'ruby', '-v' })) - - local host, _ = vim.provider.ruby.detect() - if (not host) or host:find('^%s*$') then - health.warn('`neovim-ruby-host` not found.', { - 'Run `gem install neovim` to ensure the neovim RubyGem is installed.', - 'Run `gem environment` to ensure the gem bin directory is in $PATH.', - 'If you are using rvm/rbenv/chruby, try "rehashing".', - 'See :help g:ruby_host_prog for non-standard gem installations.', - 'You may disable this provider (and warning) by adding `let g:loaded_ruby_provider = 0` to your init.vim', - }) - return - end - health.info('Host: ' .. host) - - local latest_gem_cmd = (iswin and 'cmd /c gem list -ra "^^neovim$"' or 'gem list -ra ^neovim$') - local ok, latest_gem = health.cmd_ok(vim.split(latest_gem_cmd, ' ')) - if not ok or latest_gem:find('^%s*$') then - health.error( - 'Failed to run: ' .. latest_gem_cmd, - { "Make sure you're connected to the internet.", 'Are you behind a firewall or proxy?' } - ) - return - end - local gem_split = vim.split(latest_gem, [[neovim (\|, \|)$]]) - latest_gem = gem_split[1] or 'not found' - - local current_gem_cmd = { host, '--version' } - local current_gem - ok, current_gem = health.cmd_ok(current_gem_cmd) - if not ok then - health.error( - 'Failed to run: ' .. table.concat(current_gem_cmd, ' '), - { 'Report this issue with the output of: ', table.concat(current_gem_cmd, ' ') } - ) - return - end - - if vim.version.lt(current_gem, latest_gem) then - local message = 'Gem "neovim" is out-of-date. Installed: ' - .. current_gem - .. ', latest: ' - .. latest_gem - health.warn(message, 'Run in shell: gem update neovim') - else - health.ok('Latest "neovim" gem is installed: ' .. current_gem) - end -end - -return M -- cgit