aboutsummaryrefslogtreecommitdiffstats
path: root/lua
diff options
context:
space:
mode:
Diffstat (limited to 'lua')
-rw-r--r--lua/nvim-treesitter/config.lua8
-rw-r--r--lua/nvim-treesitter/health.lua2
-rw-r--r--lua/nvim-treesitter/init.lua8
-rw-r--r--lua/nvim-treesitter/install.lua4
4 files changed, 15 insertions, 7 deletions
diff --git a/lua/nvim-treesitter/config.lua b/lua/nvim-treesitter/config.lua
index e46e2d5d1..1a5b56cdb 100644
--- a/lua/nvim-treesitter/config.lua
+++ b/lua/nvim-treesitter/config.lua
@@ -41,7 +41,7 @@ end
---@param type 'queries'|'parsers'?
---@return string[]
-function M.installed_languages(type)
+function M.get_installed(type)
local installed = {} --- @type table<string, boolean>
if not (type and type == 'parsers') then
for f in vim.fs.dir(M.get_install_dir('queries')) do
@@ -107,7 +107,7 @@ function M.norm_languages(languages, skip)
if vim.list_contains(languages, 'all') then
if skip and skip.missing then
- return M.installed_languages()
+ return M.get_installed()
end
languages = M.get_available()
end
@@ -115,7 +115,7 @@ function M.norm_languages(languages, skip)
languages = expand_tiers(languages)
if skip and skip.installed then
- local installed = M.installed_languages()
+ local installed = M.get_installed()
languages = vim.tbl_filter(
--- @param v string
function(v)
@@ -126,7 +126,7 @@ function M.norm_languages(languages, skip)
end
if skip and skip.missing then
- local installed = M.installed_languages()
+ local installed = M.get_installed()
languages = vim.tbl_filter(
--- @param v string
function(v)
diff --git a/lua/nvim-treesitter/health.lua b/lua/nvim-treesitter/health.lua
index 4095bce00..3f5058996 100644
--- a/lua/nvim-treesitter/health.lua
+++ b/lua/nvim-treesitter/health.lua
@@ -136,7 +136,7 @@ function M.check()
-- Parser installation checks
health.start('Installed languages' .. string.rep(' ', 5) .. 'H L F I J')
- local languages = config.installed_languages()
+ local languages = config.get_installed()
for _, lang in pairs(languages) do
local parser = parsers[lang]
local out = lang .. string.rep(' ', 22 - #lang)
diff --git a/lua/nvim-treesitter/init.lua b/lua/nvim-treesitter/init.lua
index 561c1697a..c5a9201f3 100644
--- a/lua/nvim-treesitter/init.lua
+++ b/lua/nvim-treesitter/init.lua
@@ -4,6 +4,14 @@ function M.setup(...)
require('nvim-treesitter.config').setup(...)
end
+function M.get_available(...)
+ return require('nvim-treesitter.config').get_available(...)
+end
+
+function M.get_installed(...)
+ return require('nvim-treesitter.config').get_installed(...)
+end
+
function M.install(...)
return require('nvim-treesitter.install').install(...)
end
diff --git a/lua/nvim-treesitter/install.lua b/lua/nvim-treesitter/install.lua
index 6391beba9..eb55d0191 100644
--- a/lua/nvim-treesitter/install.lua
+++ b/lua/nvim-treesitter/install.lua
@@ -402,7 +402,7 @@ local install_status = {} ---@type table<string,InstallStatus?>
---@param generate? boolean
---@return InstallStatus status
local function install_lang(lang, cache_dir, install_dir, force, generate)
- if not force and vim.list_contains(config.installed_languages(), lang) then
+ if not force and vim.list_contains(config.get_installed(), lang) then
install_status[lang] = 'installed'
return 'installed'
end
@@ -537,7 +537,7 @@ M.uninstall = a.async(function(languages)
local parser_dir = config.get_install_dir('parser')
local query_dir = config.get_install_dir('queries')
- local installed = config.installed_languages()
+ local installed = config.get_installed()
local task_funs = {} ---@type async.TaskFun[]
local done = 0