Skip to content

Commit 0b0bec6

Browse files
chore: update unit test init to use nvim-treesitter main branch
1 parent 4a39681 commit 0b0bec6

File tree

3 files changed

+25
-26
lines changed

3 files changed

+25
-26
lines changed

demo/minit.lua

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,17 +45,23 @@ require('lazy').setup({
4545
},
4646
{
4747
'nvim-treesitter/nvim-treesitter',
48+
branch = 'main',
4849
build = ':TSUpdate',
4950
config = function()
50-
---@diagnostic disable-next-line: missing-fields
51-
require('nvim-treesitter.configs').setup({
52-
ensure_installed = {
53-
'html',
54-
'latex',
55-
'markdown',
56-
'markdown_inline',
57-
},
58-
highlight = { enable = true },
51+
require('nvim-treesitter').install({
52+
'html',
53+
'latex',
54+
'markdown',
55+
'markdown_inline',
56+
})
57+
58+
local group = vim.api.nvim_create_augroup('Highlighter', {})
59+
vim.api.nvim_create_autocmd('FileType', {
60+
group = group,
61+
pattern = 'markdown',
62+
callback = function(args)
63+
vim.treesitter.start(args.buf)
64+
end,
5965
})
6066
end,
6167
},

doc/render-markdown.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*render-markdown.txt* For NVIM v0.11.1 Last change: 2025 May 27
1+
*render-markdown.txt* For NVIM v0.11.1 Last change: 2025 May 29
22

33
==============================================================================
44
Table of Contents *render-markdown-table-of-contents*

tests/minimal_init.lua

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,6 @@ local function get_path(name)
77
return plugin_path[1]
88
end
99

10-
---https://github.com/ThePrimeagen/refactoring.nvim/blob/master/scripts/minimal.vim
11-
---@param parsers string[]
12-
local function ensure_installed(parsers)
13-
local installed = require('nvim-treesitter.info').installed_parsers()
14-
local missing = vim.tbl_filter(function(parser)
15-
return not vim.tbl_contains(installed, parser)
16-
end, parsers)
17-
if #missing > 0 then
18-
vim.cmd.TSInstallSync({ bang = true, args = missing })
19-
end
20-
end
21-
2210
-- settings
2311
vim.opt.lines = 40
2412
vim.opt.columns = 80
@@ -36,11 +24,16 @@ vim.cmd.runtime('plugin/render-markdown.lua')
3624
vim.opt.rtp:prepend(get_path('plenary.nvim'))
3725
vim.cmd.runtime('plugin/plenary.vim')
3826

39-
ensure_installed({ 'html', 'latex', 'markdown', 'markdown_inline' })
27+
require('nvim-treesitter')
28+
.install({ 'html', 'latex', 'markdown', 'markdown_inline' })
29+
:wait(60000)
4030

41-
---@diagnostic disable-next-line: missing-fields
42-
require('nvim-treesitter.configs').setup({
43-
highlight = { enable = true },
31+
vim.api.nvim_create_autocmd('FileType', {
32+
group = vim.api.nvim_create_augroup('Highlighter', {}),
33+
pattern = 'markdown',
34+
callback = function(args)
35+
vim.treesitter.start(args.buf)
36+
end,
4437
})
4538

4639
require('mini.icons').setup({})

0 commit comments

Comments
 (0)