mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-11 16:00:02 -04:00
health: add highlight to healthchecks
This commit is contained in:
parent
f8b39e1d3a
commit
4d4e7d8a8c
2 changed files with 18 additions and 0 deletions
|
|
@ -3,6 +3,7 @@ local fn = vim.fn
|
||||||
|
|
||||||
local queries = require'nvim-treesitter.query'
|
local queries = require'nvim-treesitter.query'
|
||||||
local locals = require'nvim-treesitter.locals'
|
local locals = require'nvim-treesitter.locals'
|
||||||
|
local highlight = require'nvim-treesitter.highlight'
|
||||||
local configs = require'nvim-treesitter.configs'
|
local configs = require'nvim-treesitter.configs'
|
||||||
|
|
||||||
local health_start = vim.fn["health#report_start"]
|
local health_start = vim.fn["health#report_start"]
|
||||||
|
|
@ -51,6 +52,7 @@ function M.checkhealth()
|
||||||
health_ok(parser_name .. " parser found.")
|
health_ok(parser_name .. " parser found.")
|
||||||
|
|
||||||
locals.checkhealth(parser_name)
|
locals.checkhealth(parser_name)
|
||||||
|
highlight.checkhealth(parser_name)
|
||||||
elseif installed > 1 then
|
elseif installed > 1 then
|
||||||
health_warn(string.format("Multiple parsers found for %s, only %s will be used.", parser_name, installed[1]))
|
health_warn(string.format("Multiple parsers found for %s, only %s will be used.", parser_name, installed[1]))
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -25,4 +25,20 @@ function M.detach(bufnr)
|
||||||
api.nvim_buf_set_option(buf, 'syntax', 'on')
|
api.nvim_buf_set_option(buf, 'syntax', 'on')
|
||||||
end
|
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
|
return M
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue