Skip to content

Commit 1387615

Browse files
Move get_parser call to only where it is needed
1 parent 726c85c commit 1387615

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lua/render-markdown/ui.lua

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ M.refresh = function(buf, mode, parse)
6565
end
6666

6767
-- Re compute marks, needed in-between text changes
68-
local parser = vim.treesitter.get_parser(buf)
6968
if parse then
69+
local parser = vim.treesitter.get_parser(buf)
7070
-- Make sure injections are processed
7171
parser:parse(true)
7272
-- Parse and cache marks
@@ -125,10 +125,12 @@ M.parse = function(buf, language, root)
125125
if user_handler ~= nil then
126126
logger.debug('Running user handler')
127127
-- TODO: remove call to render & parse nil check
128+
---@diagnostic disable-next-line: undefined-field
128129
if user_handler.render ~= nil then
129130
local message = 'markdown.nvim: custom_handlers render is deprecated use parse instead'
130131
message = message .. ', will be fully removed on 2024-08-19'
131132
vim.notify_once(message, vim.log.levels.ERROR)
133+
---@diagnostic disable-next-line: undefined-field
132134
user_handler.render(M.namespace, root, buf)
133135
end
134136
if user_handler.parse ~= nil then

0 commit comments

Comments
 (0)