diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2024-04-21 18:04:21 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-21 18:04:21 -0700 |
commit | 2088521263d3bf9cfd23729adb1a7d152eaab104 (patch) | |
tree | 6c153f0c1d1ff1ebc36a466e904c933ccee18b28 /runtime/lua/vim/health.lua | |
parent | 35e38833c54565b05a0c33ba44694fc1077dce97 (diff) | |
parent | f112ac73bd340707173db4d28660e76aa96b36de (diff) | |
download | rneovim-2088521263d3bf9cfd23729adb1a7d152eaab104.tar.gz rneovim-2088521263d3bf9cfd23729adb1a7d152eaab104.tar.bz2 rneovim-2088521263d3bf9cfd23729adb1a7d152eaab104.zip |
Merge #28450 deprecate tbl_flatten
Diffstat (limited to 'runtime/lua/vim/health.lua')
-rw-r--r-- | runtime/lua/vim/health.lua | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/runtime/lua/vim/health.lua b/runtime/lua/vim/health.lua index 18d20d4b40..d72a32b541 100644 --- a/runtime/lua/vim/health.lua +++ b/runtime/lua/vim/health.lua @@ -366,17 +366,20 @@ end local PATTERNS = { '/autoload/health/*.vim', '/lua/**/**/health.lua', '/lua/**/**/health/init.lua' } --- :checkhealth completion function used by cmdexpand.c get_healthcheck_names() M._complete = function() - local names = vim.tbl_flatten(vim.tbl_map(function(pattern) - return vim.tbl_map(path2name, vim.api.nvim_get_runtime_file(pattern, true)) - end, PATTERNS)) - -- Remove duplicates - local unique = {} - vim.tbl_map(function(f) - unique[f] = true - end, names) + local unique = vim + .iter(vim.tbl_map(function(pattern) + return vim.tbl_map(path2name, vim.api.nvim_get_runtime_file(pattern, true)) + end, PATTERNS)) + :flatten() + :fold({}, function(t, name) + t[name] = true -- Remove duplicates + return t + end) -- vim.health is this file, which is not a healthcheck unique['vim'] = nil - return vim.tbl_keys(unique) + local rv = vim.tbl_keys(unique) + table.sort(rv) + return rv end --- Runs the specified healthchecks. |