mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-18 19:30:02 -04:00
Check for node-js on :TSInstallFromGrammar
Ref: https://github.com/nvim-treesitter/nvim-treesitter/issues/1121#issuecomment-811755767
This commit is contained in:
parent
0f9bdb0939
commit
c16a6c972b
2 changed files with 14 additions and 0 deletions
|
|
@ -25,6 +25,17 @@ local function install_health()
|
||||||
health_ok('`tree-sitter` found '..version..' (parser generator, only needed for :TSInstallFromGrammar)')
|
health_ok('`tree-sitter` found '..version..' (parser generator, only needed for :TSInstallFromGrammar)')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if fn.executable('node') == 0 then
|
||||||
|
health_warn('`node` executable not found (only needed for :TSInstallFromGrammar,'..
|
||||||
|
' not required for :TSInstall)')
|
||||||
|
else
|
||||||
|
local handle = io.popen('node --version')
|
||||||
|
local result = handle:read("*a")
|
||||||
|
handle:close()
|
||||||
|
local version = vim.split(result,'\n')[1]
|
||||||
|
health_ok('`node` found '..version..' (only needed for :TSInstallFromGrammar)')
|
||||||
|
end
|
||||||
|
|
||||||
if fn.executable('git') == 0 then
|
if fn.executable('git') == 0 then
|
||||||
health_error('`git` executable not found.', {
|
health_error('`git` executable not found.', {
|
||||||
'Install it with your package manager.',
|
'Install it with your package manager.',
|
||||||
|
|
|
||||||
|
|
@ -169,6 +169,9 @@ local function run_install(cache_folder, install_folder, lang, repo, with_sync,
|
||||||
end
|
end
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
if generate_from_grammar and vim.fn.executable('node') ~= 1 then
|
||||||
|
api.nvim_err_writeln('node JS not found: `node` is not executable!')
|
||||||
|
end
|
||||||
local cc = shell.select_executable(M.compilers)
|
local cc = shell.select_executable(M.compilers)
|
||||||
if not cc then
|
if not cc then
|
||||||
api.nvim_err_writeln('No C compiler found! "'
|
api.nvim_err_writeln('No C compiler found! "'
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue