aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/treesitter.lua
diff options
context:
space:
mode:
authorChinmay Dalal <dalal.chinmay.0101@gmail.com>2022-04-22 19:45:28 +0530
committerGitHub <noreply@github.com>2022-04-22 16:15:28 +0200
commit116a3f4683de501228b422f67cf1030bee78759c (patch)
treeb17a4371a99d6dfc8c1f9473462a5207ee35cd7a /runtime/lua/vim/treesitter.lua
parentf4f593b3331a29590355322884d5b89e8660e5e8 (diff)
downloadrneovim-116a3f4683de501228b422f67cf1030bee78759c.tar.gz
rneovim-116a3f4683de501228b422f67cf1030bee78759c.tar.bz2
rneovim-116a3f4683de501228b422f67cf1030bee78759c.zip
fix(treesitter): create new parser if language is not the same as cached parser (#18149)
Diffstat (limited to 'runtime/lua/vim/treesitter.lua')
-rw-r--r--runtime/lua/vim/treesitter.lua2
1 files changed, 1 insertions, 1 deletions
diff --git a/runtime/lua/vim/treesitter.lua b/runtime/lua/vim/treesitter.lua
index f9d539f028..55398d8180 100644
--- a/runtime/lua/vim/treesitter.lua
+++ b/runtime/lua/vim/treesitter.lua
@@ -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