diff options
| author | Kiyan Yazdani <yazdani.kiyan@protonmail.com> | 2020-04-21 18:26:07 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-04-21 18:26:07 +0200 |
| commit | b72559f9c2d87a90dbe8417276571c953b7b5292 (patch) | |
| tree | 916f722c69f23c85247b65528a74ff9c17382f87 /lua/nvim-treesitter/install.lua | |
| parent | 8b01b9caee849253713adbdf156a4dac843349a4 (diff) | |
| parent | 698453e50ca1341245ff6c3f5303991a6f919342 (diff) | |
Merge pull request #12 from vigoux/checkhealth
feat: checkhealth
Diffstat (limited to 'lua/nvim-treesitter/install.lua')
| -rw-r--r-- | lua/nvim-treesitter/install.lua | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/lua/nvim-treesitter/install.lua b/lua/nvim-treesitter/install.lua index 62af9a62..7674c4b0 100644 --- a/lua/nvim-treesitter/install.lua +++ b/lua/nvim-treesitter/install.lua @@ -3,7 +3,7 @@ local fn = vim.fn local luv = vim.loop local M = {} -local repositories = { +M.repositories = { javascript = { url = "https://github.com/tree-sitter/tree-sitter-javascript", files = { "src/parser.c", "src/scanner.c" }, @@ -198,4 +198,28 @@ function M.install_parser(ft) run_install(cache_folder, package_path, ft, repository) end +function M.checkhealth() + 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 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 + return M |
