mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-18 11:20:07 -04:00
feat: sync install for ensure_installed
This commit is contained in:
parent
83efae51bf
commit
aaf157a6a9
3 changed files with 8 additions and 1 deletions
|
|
@ -107,6 +107,7 @@ All modules are disabled by default and need to be activated explicitly in your
|
||||||
lua <<EOF
|
lua <<EOF
|
||||||
require'nvim-treesitter.configs'.setup {
|
require'nvim-treesitter.configs'.setup {
|
||||||
ensure_installed = "maintained", -- one of "all", "maintained" (parsers with maintainers), or a list of languages
|
ensure_installed = "maintained", -- one of "all", "maintained" (parsers with maintainers), or a list of languages
|
||||||
|
sync_install = true, -- install languages synchronously
|
||||||
ignore_install = { "javascript" }, -- List of parsers to ignore installing
|
ignore_install = { "javascript" }, -- List of parsers to ignore installing
|
||||||
highlight = {
|
highlight = {
|
||||||
enable = true, -- false will disable the whole extension
|
enable = true, -- false will disable the whole extension
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ local M = {}
|
||||||
|
|
||||||
local config = {
|
local config = {
|
||||||
modules = {},
|
modules = {},
|
||||||
|
sync_install = false,
|
||||||
ensure_installed = {},
|
ensure_installed = {},
|
||||||
ignore_install = {},
|
ignore_install = {},
|
||||||
update_strategy = "lockfile",
|
update_strategy = "lockfile",
|
||||||
|
|
@ -366,7 +367,11 @@ function M.setup(user_data)
|
||||||
|
|
||||||
local ensure_installed = user_data.ensure_installed or {}
|
local ensure_installed = user_data.ensure_installed or {}
|
||||||
if #ensure_installed > 0 then
|
if #ensure_installed > 0 then
|
||||||
require("nvim-treesitter.install").ensure_installed(ensure_installed)
|
if user_data.sync_install then
|
||||||
|
require("nvim-treesitter.install").ensure_sync_installed(ensure_installed)
|
||||||
|
else
|
||||||
|
require("nvim-treesitter.install").ensure_installed(ensure_installed)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
config.modules.ensure_installed = nil
|
config.modules.ensure_installed = nil
|
||||||
|
|
|
||||||
|
|
@ -521,6 +521,7 @@ function M.write_lockfile(verbose, skip_langs)
|
||||||
end
|
end
|
||||||
|
|
||||||
M.ensure_installed = install { exclude_configured_parsers = true }
|
M.ensure_installed = install { exclude_configured_parsers = true }
|
||||||
|
M.ensure_sync_installed = install { with_sync = true, exclude_configured_parsers = true }
|
||||||
|
|
||||||
M.commands = {
|
M.commands = {
|
||||||
TSInstall = {
|
TSInstall = {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue