fix(treesitter): create new parser if language is not the same as cached parser

Fixes #18148
This commit is contained in:
Chinmay Dalal
2022-04-17 22:13:45 +05:30
parent 6e6f5a7833
commit 8e35894fc2

View File

@@ -90,7 +90,7 @@ function M.get_parser(bufnr, lang, opts)
lang = a.nvim_buf_get_option(bufnr, "filetype")
end
if parsers[bufnr] == nil then
if parsers[bufnr] == nil or parsers[bufnr]:lang() ~= lang then
parsers[bufnr] = M._create_parser(bufnr, lang, opts)
end