From 38af29a912a607d3d703f57b840bfc61671679cc Mon Sep 17 00:00:00 2001 From: kiyan42 Date: Fri, 19 Jun 2020 13:45:33 +0200 Subject: refacto: remove buf_state - remove buf_state and related code - add get_node_at_cursor() - better incremental selection (code is localized) --- lua/nvim-treesitter/utils.lua | 19 ------------------- 1 file changed, 19 deletions(-) (limited to 'lua/nvim-treesitter/utils.lua') diff --git a/lua/nvim-treesitter/utils.lua b/lua/nvim-treesitter/utils.lua index 9dc5d17b..6fa15981 100644 --- a/lua/nvim-treesitter/utils.lua +++ b/lua/nvim-treesitter/utils.lua @@ -45,23 +45,4 @@ function M.get_cache_dir() return nil, 'Invalid cache rights, $XDG_CACHE_HOME or /tmp should be read/write' end -function M.has_parser(lang) - local lang = lang or api.nvim_buf_get_option(0, 'filetype') - return #api.nvim_get_runtime_file('parser/' .. lang .. '.so', false) > 0 -end - -function M.get_parser(bufnr, lang) - if M.has_parser() then - local buf = bufnr or api.nvim_get_current_buf() - local lang = lang or api.nvim_buf_get_option(buf, 'ft') - if not M[buf] then - M[buf] = {} - end - if not M[buf][lang] then - M[buf][lang] = ts.get_parser(buf, lang) - end - return M[buf][lang] - end -end - return M -- cgit v1.2.3