summaryrefslogtreecommitdiff
path: root/lua/nvim-treesitter/health.lua
diff options
context:
space:
mode:
authorThomas Vigouroux <tomvig38@gmail.com>2020-04-26 15:38:32 +0200
committerThomas Vigouroux <tomvig38@gmail.com>2020-04-26 15:38:32 +0200
commitce690e550d0905a9c4f177064e709f5e22d95fe8 (patch)
treeaacd751550ad35831c1ef087893436d142ce8e03 /lua/nvim-treesitter/health.lua
parent4d4e7d8a8c03c958e8badf7e3ee34e444ddcb4e0 (diff)
health(refactor): move checks inside health.lua
Diffstat (limited to 'lua/nvim-treesitter/health.lua')
-rw-r--r--lua/nvim-treesitter/health.lua25
1 files changed, 23 insertions, 2 deletions
diff --git a/lua/nvim-treesitter/health.lua b/lua/nvim-treesitter/health.lua
index 86216187..7ba1cae6 100644
--- a/lua/nvim-treesitter/health.lua
+++ b/lua/nvim-treesitter/health.lua
@@ -35,6 +35,27 @@ local function install_health()
end
end
+local function highlight_health(lang)
+ if not queries.get_query(lang, "highlights") then
+ health_warn("No `highlights.scm` query found for " .. lang, {
+ "Open an issue at https://github.com/nvim-treesitter/nvim-treesitter"
+ })
+ else
+ health_ok("`highlights.scm` found.")
+ end
+end
+
+function locals_health(lang)
+ if not queries.get_query(lang, "locals") then
+ health_warn("No `locals.scm` query found for " .. lang, {
+ "Open an issue at https://github.com/nvim-treesitter/nvim-treesitter"
+ })
+ else
+ health_ok("`locals.scm` found.")
+ end
+end
+
+
-- TODO(vigoux): Maybe we should move each check to be perform in its own module
function M.checkhealth()
-- Installation dependency checks
@@ -51,8 +72,8 @@ function M.checkhealth()
health_start(parser_name .. " parser healthcheck")
health_ok(parser_name .. " parser found.")
- locals.checkhealth(parser_name)
- highlight.checkhealth(parser_name)
+ locals_health(parser_name)
+ highlight_health(parser_name)
elseif installed > 1 then
health_warn(string.format("Multiple parsers found for %s, only %s will be used.", parser_name, installed[1]))
else