mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-03 12:06:55 -04:00
Add Windows support (mingw)
This commit is contained in:
parent
34160bb6f2
commit
ce7efd34c6
2 changed files with 20 additions and 15 deletions
|
|
@ -58,6 +58,10 @@ local function iter_cmd_sync(cmd_list)
|
|||
return true
|
||||
end
|
||||
|
||||
local function select_executable(executables)
|
||||
return vim.tbl_filter(function(c) return fn.executable(c) == 1 end, executables)[1]
|
||||
end
|
||||
|
||||
local function run_install(cache_folder, package_path, lang, repo, with_sync)
|
||||
parsers.reset_cache()
|
||||
|
||||
|
|
@ -66,6 +70,14 @@ local function run_install(cache_folder, package_path, lang, repo, with_sync)
|
|||
-- compile_location only needed for typescript installs.
|
||||
local compile_location = cache_folder..'/'..(repo.location or project_name)
|
||||
local parser_lib_name = package_path.."/parser/"..lang..".so"
|
||||
|
||||
local compilers = { "cc", "gcc", "clang" }
|
||||
local cc = select_executable(compilers)
|
||||
if not cc then
|
||||
api.nvim_err_writeln('No C compiler found! "'..table.concat(compilers, '", "')..'" are not executable.')
|
||||
return
|
||||
end
|
||||
|
||||
local command_list = {
|
||||
{
|
||||
cmd = 'rm',
|
||||
|
|
@ -83,7 +95,7 @@ local function run_install(cache_folder, package_path, lang, repo, with_sync)
|
|||
},
|
||||
},
|
||||
{
|
||||
cmd = 'cc',
|
||||
cmd = cc,
|
||||
info = 'Compiling...',
|
||||
err = 'Error during compilation',
|
||||
opts = {
|
||||
|
|
@ -148,12 +160,8 @@ local function install_lang(lang, ask_reinstall, cache_folder, package_path, wit
|
|||
run_install(cache_folder, package_path, lang, install_info, with_sync)
|
||||
end
|
||||
|
||||
-- TODO(kyazdani): this should work on windows too
|
||||
local function install(with_sync, ask_reinstall)
|
||||
return function (...)
|
||||
if fn.has('win32') == 1 then
|
||||
return api.nvim_err_writeln('This command is not available on windows at the moment.')
|
||||
end
|
||||
|
||||
if fn.executable('git') == 0 then
|
||||
return api.nvim_err_writeln('Git is required on your system to run this command')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue