diff options
| author | kiyan42 <yazdani.kiyan@protonmail.com> | 2020-06-19 13:45:33 +0200 |
|---|---|---|
| committer | kiyan42 <yazdani.kiyan@protonmail.com> | 2020-06-19 13:45:33 +0200 |
| commit | 38af29a912a607d3d703f57b840bfc61671679cc (patch) | |
| tree | 28c4fca6a638b28c923088e240dce064211cb349 /lua/nvim-treesitter/utils.lua | |
| parent | 772aa4c169969e56fd3f1208d1d6b42cd799b74a (diff) | |
refacto: remove buf_state
- remove buf_state and related code
- add get_node_at_cursor()
- better incremental selection (code is localized)
Diffstat (limited to 'lua/nvim-treesitter/utils.lua')
| -rw-r--r-- | lua/nvim-treesitter/utils.lua | 19 |
1 files changed, 0 insertions, 19 deletions
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 |
