Skip to content

Commit 048d680

Browse files
chore: update checkhealth missing highlighter advice
1 parent 0b0bec6 commit 048d680

File tree

3 files changed

+8
-15
lines changed

3 files changed

+8
-15
lines changed

demo/minit.lua

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,16 +48,12 @@ require('lazy').setup({
4848
branch = 'main',
4949
build = ':TSUpdate',
5050
config = function()
51-
require('nvim-treesitter').install({
52-
'html',
53-
'latex',
54-
'markdown',
55-
'markdown_inline',
56-
})
51+
require('nvim-treesitter')
52+
.install({ 'html', 'latex', 'markdown', 'markdown_inline' })
53+
:wait()
5754

58-
local group = vim.api.nvim_create_augroup('Highlighter', {})
5955
vim.api.nvim_create_autocmd('FileType', {
60-
group = group,
56+
group = vim.api.nvim_create_augroup('Highlighter', {}),
6157
pattern = 'markdown',
6258
callback = function(args)
6359
vim.treesitter.start(args.buf)

lua/render-markdown/health.lua

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ local state = require('render-markdown.state')
55
local M = {}
66

77
---@private
8-
M.version = '8.4.7'
8+
M.version = '8.4.8'
99

1010
function M.check()
1111
M.start('version')
@@ -119,19 +119,16 @@ end
119119
---@private
120120
---@param language string
121121
function M.highlighter(language)
122-
-- nvim-treesitter is removing module support so cannot be used to check
123-
-- if highlights are enabled, so we create a buffer and check the state
122+
-- create a temporary buffer to check if vim.treesitter.start gets called
124123
local buf = vim.api.nvim_create_buf(false, true)
125124
vim.bo[buf].filetype = language
126125
local ok = vim.treesitter.highlighter.active[buf] ~= nil
127126
vim.api.nvim_buf_delete(buf, { force = true })
128127
if ok then
129128
vim.health.ok(language .. ': highlighter enabled')
130129
else
131-
-- TODO(1.0): update advice once module support is removed
132130
vim.health.error(language .. ': highlighter not enabled', {
133-
'enable the highlight module in your nvim-treesitter config',
134-
"require('nvim-treesitter.configs').setup({ highlight = { enable = true } })",
131+
('call vim.treesitter.start on %s buffers'):format(language),
135132
})
136133
end
137134
end

tests/minimal_init.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ vim.cmd.runtime('plugin/plenary.vim')
2626

2727
require('nvim-treesitter')
2828
.install({ 'html', 'latex', 'markdown', 'markdown_inline' })
29-
:wait(60000)
29+
:wait()
3030

3131
vim.api.nvim_create_autocmd('FileType', {
3232
group = vim.api.nvim_create_augroup('Highlighter', {}),

0 commit comments

Comments
 (0)