diff options
| author | Kiyan Yazdani <yazdani.kiyan@protonmail.com> | 2020-04-26 16:52:41 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-04-26 16:52:41 +0200 |
| commit | efd363f810883d13102da6e1965288f1b36f35d9 (patch) | |
| tree | aacd751550ad35831c1ef087893436d142ce8e03 /lua | |
| parent | Merge pull request #23 from vigoux/feature/textobjects (diff) | |
| parent | health(refactor): move checks inside health.lua (diff) | |
| download | nvim-treesitter-efd363f810883d13102da6e1965288f1b36f35d9.tar nvim-treesitter-efd363f810883d13102da6e1965288f1b36f35d9.tar.gz nvim-treesitter-efd363f810883d13102da6e1965288f1b36f35d9.tar.bz2 nvim-treesitter-efd363f810883d13102da6e1965288f1b36f35d9.tar.lz nvim-treesitter-efd363f810883d13102da6e1965288f1b36f35d9.tar.xz nvim-treesitter-efd363f810883d13102da6e1965288f1b36f35d9.tar.zst nvim-treesitter-efd363f810883d13102da6e1965288f1b36f35d9.zip | |
Merge pull request #28 from vigoux/checkhealth-highlight
Add highlight to healthchecks
Diffstat (limited to 'lua')
| -rw-r--r-- | lua/nvim-treesitter/health.lua | 25 | ||||
| -rw-r--r-- | lua/nvim-treesitter/locals.lua | 16 |
2 files changed, 24 insertions, 17 deletions
diff --git a/lua/nvim-treesitter/health.lua b/lua/nvim-treesitter/health.lua index 563e46a90..7ba1cae65 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"] @@ -34,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 @@ -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 diff --git a/lua/nvim-treesitter/locals.lua b/lua/nvim-treesitter/locals.lua index 1e19fcd43..3e5174548 100644 --- a/lua/nvim-treesitter/locals.lua +++ b/lua/nvim-treesitter/locals.lua @@ -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 |
