Skip to content

Commit 24aacee

Browse files
feat: better support for reloading with lazy.nvim
## Details The goal is being able to run `:Lazy reload render-markdown.nvim` in order to quickly check changes to configuration as well as code. After some recent changes `extmarks` can sometimes get stuck forever as the cache gets reloaded but the buffer is never fully cleared. To improve this 2 minor changes were made: - use `vim.api.nvim_list_bufs()` when clearing the namespace instead of the keys in `M.cache`, that way we capture previously cached buffers - in addition to hiding all the `extmarks` when clearing, add a call to `vim.api.nvim_buf_clear_namespace` to make sure no longer visible marks are also removed
1 parent 0944ba0 commit 24aacee

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

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.2 Last change: 2025 June 21
1+
*render-markdown.txt* For NVIM v0.11.2 Last change: 2025 June 22
22

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

lua/render-markdown/core/ui.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ M.cache = {}
2727
function M.setup(config)
2828
M.config = config
2929
-- clear marks and reset cache
30-
for buf in pairs(M.cache) do
30+
for _, buf in ipairs(vim.api.nvim_list_bufs()) do
3131
vim.api.nvim_buf_clear_namespace(buf, M.ns, 0, -1)
3232
end
3333
M.cache = {}
@@ -133,6 +133,7 @@ function Updater:clear()
133133
for _, extmark in ipairs(extmarks) do
134134
extmark:hide(M.ns, self.buf)
135135
end
136+
vim.api.nvim_buf_clear_namespace(self.buf, M.ns, 0, -1)
136137
M.config.on.clear({ buf = self.buf, win = self.win })
137138
end
138139

lua/render-markdown/health.lua

Lines changed: 1 addition & 1 deletion
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.5.9'
8+
M.version = '8.5.10'
99

1010
function M.check()
1111
M.start('version')

0 commit comments

Comments
 (0)