Skip to content

Commit 6d153d7

Browse files
Move treesitter parsing into scheduled function, reduce startup time
1 parent 14b3a01 commit 6d153d7

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lua/render-markdown/init.lua

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -236,11 +236,11 @@ M.default_config = {
236236
function M.setup(opts)
237237
state.config = vim.tbl_deep_extend('force', M.default_config, opts or {})
238238
state.enabled = state.config.start_enabled
239-
state.markdown_query = vim.treesitter.query.parse('markdown', state.config.markdown_query)
240-
state.inline_query = vim.treesitter.query.parse('markdown_inline', state.config.inline_query)
241-
239+
vim.schedule(function()
240+
state.markdown_query = vim.treesitter.query.parse('markdown', state.config.markdown_query)
241+
state.inline_query = vim.treesitter.query.parse('markdown_inline', state.config.inline_query)
242+
end)
242243
manager.setup()
243-
244244
vim.api.nvim_create_user_command(
245245
'RenderMarkdownToggle',
246246
M.toggle,

0 commit comments

Comments
 (0)