Skip to content

Commit c108a8d

Browse files
committed
feat(renderer): make markdown rendering debounce configurable
1 parent ed2da71 commit c108a8d

File tree

4 files changed

+12
-2
lines changed

4 files changed

+12
-2
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,9 @@ require('opencode').setup({
172172
tools = {
173173
show_output = true, -- Show tools output [diffs, cmd output, etc.] (default: true)
174174
},
175+
rendering = {
176+
markdown_debounce_ms = 250, -- Debounce time for markdown rendering on new data (default: 250ms)
177+
},
175178
},
176179
input = {
177180
text = {

lua/opencode/config.lua

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,9 @@ M.defaults = {
9191
frames = { '·', '', '', '', '', '', '', '', '', '' },
9292
},
9393
output = {
94+
rendering = {
95+
markdown_debounce_ms = 250,
96+
},
9497
tools = {
9598
show_output = true,
9699
},

lua/opencode/types.lua

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,15 @@
9292
---@field window_highlight string
9393
---@field icons { preset: 'emoji'|'text'|'nerdfonts', overrides: table<string,string> }
9494
---@field loading_animation OpencodeLoadingAnimationConfig
95-
---@field output { tools: { show_output: boolean } }
95+
---@field output OpencodeUIOutputConfig
9696
---@field input { text: { wrap: boolean } }
9797
---@field completion OpencodeCompletionConfig
9898
---@field on_data_rendered fun(ctx: { buf: integer, win: integer })|nil
9999

100+
---@class OpencodeUIOutputConfig
101+
---@field tools { show_output: boolean }
102+
---@field rendering { markdown_debounce_ms: number }
103+
100104
---@class OpencodeContextConfig
101105
---@field enabled boolean
102106
---@field cursor_data { enabled: boolean }

lua/opencode/ui/renderer.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ local trigger_on_data_rendered = require('opencode.util').debounce(function()
3030
elseif vim.fn.exists(':Markview') > 0 then
3131
vim.cmd(':Markview render ' .. state.windows.output_buf)
3232
end
33-
end, 250)
33+
end, config.ui.output.rendering.markdown_debounce_ms or 250)
3434

3535
---Reset renderer state
3636
function M.reset()

0 commit comments

Comments
 (0)