From 62786ec7c60ea29cbbd48ae658cde7042dba4bb3 Mon Sep 17 00:00:00 2001 From: kiyan42 Date: Wed, 22 Apr 2020 11:13:05 +0200 Subject: feat/refacto: improve configurations - You should now get the configs through functions - Configs for languages are now inside a local object called parsers - You can get the parser installation configurations with `get_parser_configs` - A new object has been initialized inside configs to specify module config (called config). - Provide functions to enable/disable a module on one buffer - Provide functions to enable/disable a module on all buffers, and if filetype is specified, for specific filetype - Provide function to determine if module is activated for a specified filetype --- lua/nvim-treesitter/health.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lua/nvim-treesitter/health.lua') diff --git a/lua/nvim-treesitter/health.lua b/lua/nvim-treesitter/health.lua index 25da7fe3..563e46a9 100644 --- a/lua/nvim-treesitter/health.lua +++ b/lua/nvim-treesitter/health.lua @@ -13,7 +13,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.', @@ -38,11 +38,11 @@ end 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 -- cgit v1.2.3 From 4d4e7d8a8c03c958e8badf7e3ee34e444ddcb4e0 Mon Sep 17 00:00:00 2001 From: Thomas Vigouroux Date: Sun, 26 Apr 2020 09:29:52 +0200 Subject: health: add highlight to healthchecks --- lua/nvim-treesitter/health.lua | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lua/nvim-treesitter/health.lua') diff --git a/lua/nvim-treesitter/health.lua b/lua/nvim-treesitter/health.lua index 563e46a9..86216187 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"] @@ -51,6 +52,7 @@ function M.checkhealth() health_ok(parser_name .. " parser found.") locals.checkhealth(parser_name) + highlight.checkhealth(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 -- cgit v1.2.3 From ce690e550d0905a9c4f177064e709f5e22d95fe8 Mon Sep 17 00:00:00 2001 From: Thomas Vigouroux Date: Sun, 26 Apr 2020 15:38:32 +0200 Subject: health(refactor): move checks inside health.lua --- lua/nvim-treesitter/health.lua | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) (limited to 'lua/nvim-treesitter/health.lua') 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 -- cgit v1.2.3