diff options
| author | kiyan42 <yazdani.kiyan@protonmail.com> | 2020-04-21 23:40:23 +0200 |
|---|---|---|
| committer | kiyan42 <yazdani.kiyan@protonmail.com> | 2020-04-21 23:40:23 +0200 |
| commit | 62ce7744db02f17b77147683b4eaa884d7f2f1f5 (patch) | |
| tree | b569c95e6d32e24c94012303fd79f284880eab52 /lua/nvim-treesitter/health.lua | |
| parent | 37932fc3d3ccc93912698237f1fe45323e57d79f (diff) | |
feat/refacto: add configs.lua, setup install
- configs.lua holds the `repositories` data
- install health moved to health.lua
- plugins loads _root.setup() on startup
- install and list command are available through vim
> use them with `:TSInstall lang` and `:TSInstallInfo`
Diffstat (limited to 'lua/nvim-treesitter/health.lua')
| -rw-r--r-- | lua/nvim-treesitter/health.lua | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/lua/nvim-treesitter/health.lua b/lua/nvim-treesitter/health.lua index b5e86980..25da7fe3 100644 --- a/lua/nvim-treesitter/health.lua +++ b/lua/nvim-treesitter/health.lua @@ -1,8 +1,9 @@ local api = vim.api +local fn = vim.fn -local install = require'nvim-treesitter.install' local queries = require'nvim-treesitter.query' local locals = require'nvim-treesitter.locals' +local configs = require'nvim-treesitter.configs' local health_start = vim.fn["health#report_start"] local health_ok = vim.fn['health#report_ok'] @@ -12,15 +13,36 @@ local health_error = vim.fn['health#report_error'] local M = {} +local function configs_health() + if fn.executable('git') == 0 then + health_error('`git` executable not found.', { + 'Install it with your package manager.', + 'Check that your `$PATH` is set correctly.' + }) + else + health_ok('`git` executable found.') + end + + if fn.executable('cc') == 0 then + health_error('`cc` executable not found.', { + 'Install `gcc` with your package manager.', + 'Install `clang` with your package manager.', + 'Check that your `$PATH` is set correctly.' + }) + else + health_ok('`cc` executable 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') - install.checkhealth() + configs_health() local missing_parsers = {} -- Parser installation checks - for parser_name, repo in pairs(install.repositories) do + for parser_name in pairs(configs.repositories) do local installed = #api.nvim_get_runtime_file('parser/'..parser_name..'.so', false) -- Only print informations about installed parsers @@ -42,7 +64,7 @@ function M.checkhealth() -- TODO(vigoux): The installation command should be changed so that its easier to find health_warn('Some parsers are not installed:\n' .. table.concat(missing_parsers, '\n'), { - "Install them using `:lua require'nvim-treesitter'.install_parser('language')`"}) + "Install them using `:TSInstall language"}) end end |
