mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-04 04:20:09 -04:00
Refactor: Add parsers.get_buf_lang
This commit is contained in:
parent
1849f30bb5
commit
a4e2692c7b
5 changed files with 18 additions and 11 deletions
|
|
@ -104,7 +104,7 @@ end
|
|||
|
||||
local function enable_module(mod, bufnr, lang)
|
||||
local bufnr = bufnr or api.nvim_get_current_buf()
|
||||
local lang = lang or parsers.ft_to_lang(api.nvim_buf_get_option(bufnr, 'ft'))
|
||||
local lang = lang or parsers.get_buf_lang(bufnr)
|
||||
|
||||
if not parsers.list[lang] then
|
||||
return
|
||||
|
|
@ -157,7 +157,7 @@ end
|
|||
|
||||
local function disable_module(mod, bufnr, lang)
|
||||
local bufnr = bufnr or api.nvim_get_current_buf()
|
||||
local lang = lang or parsers.ft_to_lang(api.nvim_buf_get_option(bufnr, 'ft'))
|
||||
local lang = lang or parsers.get_buf_lang(bufnr)
|
||||
if not lang then
|
||||
return
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue