summaryrefslogtreecommitdiff
path: root/lua/nvim-treesitter/parsers.lua
diff options
context:
space:
mode:
authorThomas Vigouroux <39092278+vigoux@users.noreply.github.com>2020-06-19 15:45:28 +0200
committerGitHub <noreply@github.com>2020-06-19 15:45:28 +0200
commit516671fe9f9de98d27024e22c014adc535b56dc7 (patch)
treefb9e1984ed56efeedb05e9adbf5041d2ce390516 /lua/nvim-treesitter/parsers.lua
parent772aa4c169969e56fd3f1208d1d6b42cd799b74a (diff)
parentcf72524b2f7e3868ea74037004913af6f935f126 (diff)
Merge pull request #89 from kyazdani42/refacto/remove-buf-state-and-api
refacto: remove buf state and api
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