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
\"<provider>\"") and off ("watching stopped"). Also normalize the
[preview.nvim] prefix in commands.lua to include the colon.
This commit is contained in:
parent
0f353446b6
commit
7995d6422d
2 changed files with 4 additions and 2 deletions
|
|
@ -27,9 +27,9 @@ local function dispatch(args)
|
||||||
if s.watching then
|
if s.watching then
|
||||||
table.insert(parts, 'watching')
|
table.insert(parts, 'watching')
|
||||||
end
|
end
|
||||||
vim.notify('[preview.nvim] ' .. table.concat(parts, ', '), vim.log.levels.INFO)
|
vim.notify('[preview.nvim]: ' .. table.concat(parts, ', '), vim.log.levels.INFO)
|
||||||
else
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -178,6 +178,7 @@ end
|
||||||
function M.toggle(bufnr, name, provider, ctx_builder)
|
function M.toggle(bufnr, name, provider, ctx_builder)
|
||||||
if watching[bufnr] then
|
if watching[bufnr] then
|
||||||
M.unwatch(bufnr)
|
M.unwatch(bufnr)
|
||||||
|
vim.notify('[preview.nvim]: watching stopped', vim.log.levels.INFO)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -202,6 +203,7 @@ function M.toggle(bufnr, name, provider, ctx_builder)
|
||||||
|
|
||||||
watching[bufnr] = au_id
|
watching[bufnr] = au_id
|
||||||
log.dbg('watching buffer %d with provider "%s"', bufnr, name)
|
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', {
|
vim.api.nvim_create_autocmd('BufWipeout', {
|
||||||
buffer = bufnr,
|
buffer = bufnr,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue