mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-18 11:20:07 -04:00
feat(config)!: remove ignore_install
This was only useful for no longer supported `auto_install` option.
This commit is contained in:
parent
864e75a85d
commit
b0a20057b0
4 changed files with 3 additions and 25 deletions
|
|
@ -59,8 +59,6 @@ require('lazy').setup(
|
||||||
require'nvim-treesitter'.setup {
|
require'nvim-treesitter'.setup {
|
||||||
-- Directory to install parsers and queries to
|
-- Directory to install parsers and queries to
|
||||||
install_dir = vim.fn.stdpath('data') .. '/site'
|
install_dir = vim.fn.stdpath('data') .. '/site'
|
||||||
-- List of parsers to ignore when installing tiers
|
|
||||||
ignore_install = { },
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,8 +26,6 @@ To configure `nvim-treesitter`, put this in your `init.lua` file:
|
||||||
-- A directory to install the parsers and queries to.
|
-- A directory to install the parsers and queries to.
|
||||||
-- Defaults to the `stdpath('data')/site` dir.
|
-- Defaults to the `stdpath('data')/site` dir.
|
||||||
install_dir = "/some/path/to/store/parsers",
|
install_dir = "/some/path/to/store/parsers",
|
||||||
-- List of parsers to ignore installing (for "stable" etc.)
|
|
||||||
ignore_install = { "some_parser" },
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NOTE: You do not need to call `setup` to use this plugin with the default
|
NOTE: You do not need to call `setup` to use this plugin with the default
|
||||||
|
|
@ -103,10 +101,6 @@ setup({opts}) *nvim-treesitter.setup()*
|
||||||
• {install_dir} (`string?`, default `stdpath('data')/site/`)
|
• {install_dir} (`string?`, default `stdpath('data')/site/`)
|
||||||
directory to install parsers and queries to. Note: will be
|
directory to install parsers and queries to. Note: will be
|
||||||
appended to |runtimepath|.
|
appended to |runtimepath|.
|
||||||
• {ignore_install} (`string[]?`) list of languages to never
|
|
||||||
install even if specified for an installation operation.
|
|
||||||
(Useful when specifying tiers instead of individual
|
|
||||||
languages.)
|
|
||||||
|
|
||||||
install({languages}, {opts}, {callback}) *nvim-treesitter.install()*
|
install({languages}, {opts}, {callback}) *nvim-treesitter.install()*
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,12 +3,10 @@ local M = {}
|
||||||
M.tiers = { 'stable', 'unstable', 'unmaintained', 'unsupported' }
|
M.tiers = { 'stable', 'unstable', 'unmaintained', 'unsupported' }
|
||||||
|
|
||||||
---@class TSConfig
|
---@class TSConfig
|
||||||
---@field ignore_install string[]
|
|
||||||
---@field install_dir string
|
---@field install_dir string
|
||||||
|
|
||||||
---@type TSConfig
|
---@type TSConfig
|
||||||
local config = {
|
local config = {
|
||||||
ignore_install = {},
|
|
||||||
install_dir = vim.fs.joinpath(vim.fn.stdpath('data'), 'site'),
|
install_dir = vim.fs.joinpath(vim.fn.stdpath('data'), 'site'),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -92,7 +90,7 @@ end
|
||||||
|
|
||||||
---Normalize languages
|
---Normalize languages
|
||||||
---@param languages? string[]|string
|
---@param languages? string[]|string
|
||||||
---@param skip? { ignored: boolean, missing: boolean, unsupported: boolean, installed: boolean, dependencies: boolean }
|
---@param skip? { missing: boolean, unsupported: boolean, installed: boolean, dependencies: boolean }
|
||||||
---@return string[]
|
---@return string[]
|
||||||
function M.norm_languages(languages, skip)
|
function M.norm_languages(languages, skip)
|
||||||
if not languages then
|
if not languages then
|
||||||
|
|
@ -110,17 +108,6 @@ function M.norm_languages(languages, skip)
|
||||||
|
|
||||||
languages = expand_tiers(languages)
|
languages = expand_tiers(languages)
|
||||||
|
|
||||||
if skip and skip.ignored then
|
|
||||||
local ignored = expand_tiers(config.ignore_install)
|
|
||||||
languages = vim.tbl_filter(
|
|
||||||
--- @param v string
|
|
||||||
function(v)
|
|
||||||
return not vim.list_contains(ignored, v)
|
|
||||||
end,
|
|
||||||
languages
|
|
||||||
)
|
|
||||||
end
|
|
||||||
|
|
||||||
if skip and skip.installed then
|
if skip and skip.installed then
|
||||||
local installed = M.installed_parsers()
|
local installed = M.installed_parsers()
|
||||||
languages = vim.tbl_filter(
|
languages = vim.tbl_filter(
|
||||||
|
|
|
||||||
|
|
@ -439,7 +439,7 @@ end
|
||||||
---@param callback? fun(boolean)
|
---@param callback? fun(boolean)
|
||||||
M.install = a.sync(function(languages, options, callback)
|
M.install = a.sync(function(languages, options, callback)
|
||||||
reload_parsers()
|
reload_parsers()
|
||||||
languages = config.norm_languages(languages, { ignored = true, unsupported = true })
|
languages = config.norm_languages(languages, { unsupported = true })
|
||||||
install(languages, options, callback)
|
install(languages, options, callback)
|
||||||
end, 3)
|
end, 3)
|
||||||
|
|
||||||
|
|
@ -451,8 +451,7 @@ M.update = a.sync(function(languages, _options, callback)
|
||||||
if not languages or #languages == 0 then
|
if not languages or #languages == 0 then
|
||||||
languages = 'all'
|
languages = 'all'
|
||||||
end
|
end
|
||||||
languages =
|
languages = config.norm_languages(languages, { missing = true, unsupported = true })
|
||||||
config.norm_languages(languages, { ignored = true, missing = true, unsupported = true })
|
|
||||||
languages = vim.tbl_filter(needs_update, languages) ---@type string[]
|
languages = vim.tbl_filter(needs_update, languages) ---@type string[]
|
||||||
|
|
||||||
if #languages > 0 then
|
if #languages > 0 then
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue