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

This commit is contained in:
Chinmay Dalal
2022-04-22 19:45:28 +05:30
committed by GitHub
parent f4f593b333
commit 116a3f4683
2 changed files with 12 additions and 1 deletions

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