diff options
Diffstat (limited to 'lua/nvim-treesitter/utils.lua')
| -rw-r--r-- | lua/nvim-treesitter/utils.lua | 11 |
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 |
