mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-06 05:20:00 -04:00
feat: add checkhealth
This commit is contained in:
parent
8b01b9caee
commit
698453e50c
4 changed files with 93 additions and 1 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue