Skip to content

Commit d63dd23

Browse files
Merge pull request #12 from venkatarenduchintala/fix/matchup-markdown-treesitter
fix(treesitter): fix markdown injection crash on nvim 0.12
2 parents 98fb642 + 42d8ea9 commit d63dd23

2 files changed

Lines changed: 13 additions & 0 deletions

File tree

lua/autocmds.lua

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,17 @@ vim.filetype.add({
3434
},
3535
})
3636

37+
-- nvim-treesitter is incompatible with nvim 0.12's captures API for markdown
38+
-- injections (TSNode[] vs TSNode mismatch in set-lang-from-info-string!),
39+
-- causing crashes in both the highlighter and vim-matchup. Stop treesitter
40+
-- for markdown until upstream fixes the predicate handler.
41+
vim.api.nvim_create_autocmd("FileType", {
42+
pattern = "markdown",
43+
callback = function()
44+
vim.treesitter.stop()
45+
end,
46+
})
47+
3748
-- Disable automatic line breaks
3849
vim.api.nvim_create_autocmd("FileType", {
3950
pattern = "*",

lua/plugins/configs/matchup.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,7 @@ return {
22
"andymass/vim-matchup",
33
config = function()
44
vim.g.matchup_matchparen_offscreen = { method = "popup" }
5+
-- disable matchup's treesitter engine for markdown (same nvim 0.12 incompatibility)
6+
vim.g.matchup_treesitter_disabled = { "markdown" }
57
end,
68
}

0 commit comments

Comments
 (0)