From 7995d6422d1fee18958a0fdce3699193a0af24f8 Mon Sep 17 00:00:00 2001 From: Barrett Ruth <62671086+barrettruth@users.noreply.github.com> Date: Tue, 3 Mar 2026 14:18:28 -0500 Subject: [PATCH] feat(compiler): notify on toggle watch start and stop (#13) Problem: :Preview toggle gave no feedback, leaving the user to guess whether watching was enabled or disabled. Solution: emit vim.notify messages when toggling on ("watching with \"\"") and off ("watching stopped"). Also normalize the [preview.nvim] prefix in commands.lua to include the colon. --- lua/preview/commands.lua | 4 ++-- lua/preview/compiler.lua | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lua/preview/commands.lua b/lua/preview/commands.lua index ad63c97..f82c726 100644 --- a/lua/preview/commands.lua +++ b/lua/preview/commands.lua @@ -27,9 +27,9 @@ local function dispatch(args) if s.watching then table.insert(parts, 'watching') end - vim.notify('[preview.nvim] ' .. table.concat(parts, ', '), vim.log.levels.INFO) + vim.notify('[preview.nvim]: ' .. table.concat(parts, ', '), vim.log.levels.INFO) else - vim.notify('[preview.nvim] unknown subcommand: ' .. subcmd, vim.log.levels.ERROR) + vim.notify('[preview.nvim]: unknown subcommand: ' .. subcmd, vim.log.levels.ERROR) end end diff --git a/lua/preview/compiler.lua b/lua/preview/compiler.lua index a247f2e..052c4f0 100644 --- a/lua/preview/compiler.lua +++ b/lua/preview/compiler.lua @@ -178,6 +178,7 @@ end function M.toggle(bufnr, name, provider, ctx_builder) if watching[bufnr] then M.unwatch(bufnr) + vim.notify('[preview.nvim]: watching stopped', vim.log.levels.INFO) return end @@ -202,6 +203,7 @@ function M.toggle(bufnr, name, provider, ctx_builder) watching[bufnr] = au_id log.dbg('watching buffer %d with provider "%s"', bufnr, name) + vim.notify('[preview.nvim]: watching with "' .. name .. '"', vim.log.levels.INFO) vim.api.nvim_create_autocmd('BufWipeout', { buffer = bufnr,