summaryrefslogtreecommitdiff
path: root/lua/nvim-treesitter/utils.lua
diff options
context:
space:
mode:
authorStephan Seitz <stephan.seitz@fau.de>2020-11-21 18:49:19 +0100
committerThomas Vigouroux <tomvig38@gmail.com>2020-11-25 08:04:54 +0100
commit25bf605940c5d8df0777f627677e68861586167f (patch)
treed1af4f77f8e2c510441ba254b52f8a43de230560 /lua/nvim-treesitter/utils.lua
parent118ace68fe2cb099acc89830ca775efa8bfd7011 (diff)
Only update outdated_parsers on TSUpdate
Diffstat (limited to 'lua/nvim-treesitter/utils.lua')
-rw-r--r--lua/nvim-treesitter/utils.lua11
1 files changed, 8 insertions, 3 deletions
diff --git a/lua/nvim-treesitter/utils.lua b/lua/nvim-treesitter/utils.lua
index 17e7ff95..de579bd6 100644
--- a/lua/nvim-treesitter/utils.lua
+++ b/lua/nvim-treesitter/utils.lua
@@ -68,9 +68,10 @@ end
-- "site" dir from "runtimepath". "site" dir will be created if it doesn't
-- exist. Using only the package dir won't work when the plugin is installed
-- with Nix, since the "/nix/store" is read-only.
-function M.get_parser_install_dir()
+function M.get_parser_install_dir(folder_name)
+ folder_name = folder_name or "parser"
local package_path = M.get_package_path()
- local package_path_parser_dir = M.join_path(package_path, "parser")
+ local package_path_parser_dir = M.join_path(package_path, folder_name)
-- If package_path is read/write, use that
if luv.fs_access(package_path_parser_dir, 'RW') then
@@ -79,7 +80,7 @@ function M.get_parser_install_dir()
local site_dir = M.get_site_dir()
local path_sep = M.get_path_sep()
- local parser_dir = M.join_path(site_dir, path_sep, 'parser')
+ local parser_dir = M.join_path(site_dir, path_sep, folder_name)
-- Try creating and using parser_dir if it doesn't exist
if not luv.fs_stat(parser_dir) then
@@ -101,6 +102,10 @@ function M.get_parser_install_dir()
return nil, join_space('Invalid cache rights,', package_path, 'or', parser_dir, 'should be read/write')
end
+function M.get_parser_info_dir()
+ return M.get_parser_install_dir('parser-info')
+end
+
-- Gets a property at path
-- @param tbl the table to access
-- @param path the '.' separated path