Skip to content

Commit 65bd8d0

Browse files
chore: add counter to decorator
## Details Adds `n` field to buffer level decorator, at times is useful to know how many changes have been processed for the buffer. Currently unused, may get added to debug logs. Handle `Context.new` returning `nil`, currently not possible, will be once we transition to async parsing. For now simply leads to another path that runs `callback(nil)`.
1 parent b8c3d47 commit 65bd8d0

File tree

6 files changed

+19
-7
lines changed

6 files changed

+19
-7
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
## Pre-release
44

5+
### Features
6+
7+
- configurable indent extmark priority [1327150](https://github.com/MeanderingProgrammer/render-markdown.nvim/commit/1327150da9b272863355f28e523050ab5450412f)
8+
- more anti_conceal.ignore elements [b8c3d47](https://github.com/MeanderingProgrammer/render-markdown.nvim/commit/b8c3d474d4da14fa1a5f9a0a18955c6e7db88f65)
9+
510
## 8.6.0 (2025-07-09)
611

712
### Features

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

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

lua/render-markdown/core/ui.lua

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -165,10 +165,14 @@ function Updater:parse(callback)
165165
if ok and parser then
166166
-- reset buffer context
167167
local context = Context.new(self.buf, self.win, self.config, self.mode)
168-
-- make sure injections are processed
169-
context.view:parse(parser)
170-
local marks = handlers.run(context, parser)
171-
callback(iter.list.map(marks, Extmark.new))
168+
if context then
169+
-- make sure injections are processed
170+
context.view:parse(parser)
171+
local marks = handlers.run(context, parser)
172+
callback(iter.list.map(marks, Extmark.new))
173+
else
174+
callback(nil)
175+
end
172176
else
173177
log.buf('error', 'Fail', self.buf, 'no treesitter parser found')
174178
callback(nil)

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.6.2'
8+
M.version = '8.6.3'
99

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

lua/render-markdown/lib/decorator.lua

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ local compat = require('render-markdown.lib.compat')
66
---@field private running boolean
77
---@field private marks render.md.Extmark[]
88
---@field private tick integer?
9+
---@field n integer
910
local Decorator = {}
1011
Decorator.__index = Decorator
1112

@@ -18,6 +19,7 @@ function Decorator.new(buf)
1819
self.running = false
1920
self.marks = {}
2021
self.tick = nil
22+
self.n = 0
2123
return self
2224
end
2325

@@ -40,6 +42,7 @@ end
4042
function Decorator:set(marks)
4143
self.marks = marks
4244
self.tick = self:get_tick()
45+
self.n = self.n + 1
4346
end
4447

4548
---@param debounce boolean

lua/render-markdown/request/context.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ end
8585
---@param win integer
8686
---@param config render.md.buf.Config
8787
---@param mode string
88-
---@return render.md.request.Context
88+
---@return render.md.request.Context?
8989
function M.new(buf, win, config, mode)
9090
local view = View.new(buf)
9191
local context = Context.new(buf, win, config, mode, view)

0 commit comments

Comments
 (0)