Skip to content

Commit 199ccf0

Browse files
committed
feat(compiler): fire PreviewWatchingStopped user event
Problem: there was no way for user config to react when preview watching stops, e.g. to clean up forward-search state for SyncTeX. Solution: fire a `PreviewWatchingStopped` user autocmd from `stop_watching` with `bufnr` and `provider` in the event data.
1 parent 08f0b03 commit 199ccf0

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

lua/preview/compiler.lua

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,10 @@ local function stop_watching(bufnr, s)
196196
s.debounce:close()
197197
s.debounce = nil
198198
end
199+
vim.api.nvim_exec_autocmds('User', {
200+
pattern = 'PreviewWatchingStopped',
201+
data = { bufnr = bufnr, provider = s.provider },
202+
})
199203
end
200204

201205
---@param bufnr integer

0 commit comments

Comments
 (0)