diff options
| author | TravonteD <tman1300@aol.com> | 2020-05-11 11:29:40 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-05-11 11:29:40 -0400 |
| commit | 73ea03fb8d45378bb4c86cd98371232403a7495a (patch) | |
| tree | 67920137c386b0876a57d7bc08ba4a9743f8881d /lua/nvim-treesitter/health.lua | |
| parent | b7fdd6ae389e1364b0dda25811ddf566fa508bc3 (diff) | |
| parent | 307c78aa1e2cc5e499469fe892108b7fcf6cdb5e (diff) | |
Merge pull request #1 from nvim-treesitter/master
Updates from master
Diffstat (limited to 'lua/nvim-treesitter/health.lua')
| -rw-r--r-- | lua/nvim-treesitter/health.lua | 31 |
1 files changed, 27 insertions, 4 deletions
diff --git a/lua/nvim-treesitter/health.lua b/lua/nvim-treesitter/health.lua index 25da7fe3..7ba1cae6 100644 --- a/lua/nvim-treesitter/health.lua +++ b/lua/nvim-treesitter/health.lua @@ -3,6 +3,7 @@ local fn = vim.fn local queries = require'nvim-treesitter.query' local locals = require'nvim-treesitter.locals' +local highlight = require'nvim-treesitter.highlight' local configs = require'nvim-treesitter.configs' local health_start = vim.fn["health#report_start"] @@ -13,7 +14,7 @@ local health_error = vim.fn['health#report_error'] local M = {} -local function configs_health() +local function install_health() if fn.executable('git') == 0 then health_error('`git` executable not found.', { 'Install it with your package manager.', @@ -34,15 +35,36 @@ local function configs_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 health_start('Installation') - configs_health() + install_health() local missing_parsers = {} -- Parser installation checks - for parser_name in pairs(configs.repositories) do + for _, parser_name in pairs(configs.available_parsers()) do local installed = #api.nvim_get_runtime_file('parser/'..parser_name..'.so', false) -- Only print informations about installed parsers @@ -50,7 +72,8 @@ function M.checkhealth() health_start(parser_name .. " parser healthcheck") health_ok(parser_name .. " parser found.") - locals.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 |
