aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/health.lua
diff options
context:
space:
mode:
authorJavier López <graulopezjavier@gmail.com>2021-08-03 15:53:09 -0500
committerJavier López <graulopezjavier@gmail.com>2021-10-04 14:28:54 -0500
commit9249dcdda1bd40c291d661650df584583cac3cf4 (patch)
tree3ff162c5e0ac383d5ddcd2172cba21fdc3692142 /runtime/lua/health.lua
parentc4d581deae9400a6489dd44ced3a4271237c9298 (diff)
downloadrneovim-9249dcdda1bd40c291d661650df584583cac3cf4.tar.gz
rneovim-9249dcdda1bd40c291d661650df584583cac3cf4.tar.bz2
rneovim-9249dcdda1bd40c291d661650df584583cac3cf4.zip
feat(runtime/health): support lua healthchecks
- Refactor health.vim to discover lua healthcheck in the runtime directories lua/**/health{/init}.lua - Support healthchecks for lua submodules e.g :checkhealth vim.lsp and also support wildcard "*" at the end for all submodules :checkhealth vim* - Refactor health.vim to use variable scope instead of output capturing - Create health.lua module to wrap report functions and future extensibility. - Move away from searching just in the runtimepath, use `nvim_get_runtime_file` due to #15632 Example: Plugin linter in rtp can declare it's checkhealts in lua module `lua/linter/health{/init}.lua` that returns a table with a method "check" that when executed calls the report functions provided by the builtin lua module require("health"). The plugin also has a submodule `/lua/linter/providers` in which it defines `/lua/linter/providers/health{/init}.lua` This plugin healthcheck can now be run by the ex command: `:checkhealth linter linter.providers` Also calling all submodules can be done by: `:checkhealth linter* And "linter" and "linter.provider" would be discovered when: `:checkhealth`
Diffstat (limited to 'runtime/lua/health.lua')
-rw-r--r--runtime/lua/health.lua23
1 files changed, 23 insertions, 0 deletions
diff --git a/runtime/lua/health.lua b/runtime/lua/health.lua
new file mode 100644
index 0000000000..142a353bf2
--- /dev/null
+++ b/runtime/lua/health.lua
@@ -0,0 +1,23 @@
+local M = {}
+
+function M.report_start(msg)
+ vim.fn['health#report_start'](msg)
+end
+
+function M.report_info(msg)
+ vim.fn['health#report_info'](msg)
+end
+
+function M.report_ok(msg)
+ vim.fn['health#report_ok'](msg)
+end
+
+function M.report_warn(msg, ...)
+ vim.fn['health#report_warn'](msg, ...)
+end
+
+function M.report_error(msg, ...)
+ vim.fn['health#report_error'](msg, ...)
+end
+
+return M