summaryrefslogtreecommitdiff
path: root/lua/nvim-treesitter/parsers.lua
diff options
context:
space:
mode:
authorkiyan42 <yazdani.kiyan@protonmail.com>2020-06-19 13:45:33 +0200
committerkiyan42 <yazdani.kiyan@protonmail.com>2020-06-19 13:45:33 +0200
commit38af29a912a607d3d703f57b840bfc61671679cc (patch)
tree28c4fca6a638b28c923088e240dce064211cb349 /lua/nvim-treesitter/parsers.lua
parent772aa4c169969e56fd3f1208d1d6b42cd799b74a (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/parsers.lua')
-rw-r--r--lua/nvim-treesitter/parsers.lua5
1 files changed, 3 insertions, 2 deletions
diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua
index 07f3e9d3..3789b7af 100644
--- a/lua/nvim-treesitter/parsers.lua
+++ b/lua/nvim-treesitter/parsers.lua
@@ -10,9 +10,10 @@ function M.has_parser(lang)
end
function M.get_parser(bufnr, lang)
+ local buf = bufnr or api.nvim_get_current_buf()
+ local lang = lang or api.nvim_buf_get_option(buf, 'ft')
+
if M.has_parser(lang) 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