mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-03 12:06:55 -04:00
health(refactor): move checks inside health.lua
This commit is contained in:
parent
4d4e7d8a8c
commit
ce690e550d
3 changed files with 23 additions and 34 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -25,20 +25,4 @@ function M.detach(bufnr)
|
|||
api.nvim_buf_set_option(buf, 'syntax', 'on')
|
||||
end
|
||||
|
||||
function M.checkhealth(lang)
|
||||
local health_start = vim.fn["health#report_start"]
|
||||
local health_ok = vim.fn['health#report_ok']
|
||||
local health_info = vim.fn['health#report_info']
|
||||
local health_warn = vim.fn['health#report_warn']
|
||||
local health_error = vim.fn['health#report_error']
|
||||
|
||||
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
|
||||
|
||||
return M
|
||||
|
|
|
|||
|
|
@ -10,22 +10,6 @@ local M = {
|
|||
locals={}
|
||||
}
|
||||
|
||||
function M.checkhealth(lang)
|
||||
local health_start = vim.fn["health#report_start"]
|
||||
local health_ok = vim.fn['health#report_ok']
|
||||
local health_info = vim.fn['health#report_info']
|
||||
local health_warn = vim.fn['health#report_warn']
|
||||
local health_error = vim.fn['health#report_error']
|
||||
|
||||
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
|
||||
|
||||
function M.collect_locals(bufnr)
|
||||
local ft = api.nvim_buf_get_option(bufnr, "ft")
|
||||
if not ft then return end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue