-
-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add status notifications for background tasks
Add a new notification system to provide user feedback for background operations like file scanning, model fetching, and API calls. This improves the user experience by making it clear when the plugin is performing work. The changes include: - New notify module for pub/sub event system - Integration with spinner UI to show status messages - Status notifications for file operations, API calls, and embeddings - Removed redundant logging in favor of user-visible notifications Signed-off-by: Tomas Slusny <[email protected]>
- Loading branch information
Showing
5 changed files
with
73 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
local log = require('plenary.log') | ||
|
||
local M = {} | ||
|
||
M.STATUS = 'status' | ||
|
||
M.listeners = {} | ||
|
||
--- Publish an event with a message | ||
---@param event_name string | ||
---@param data any | ||
function M.publish(event_name, data) | ||
if M.listeners[event_name] then | ||
log.debug(event_name .. ':', data) | ||
for _, callback in ipairs(M.listeners[event_name]) do | ||
callback(data) | ||
end | ||
end | ||
end | ||
|
||
--- Listen for an event | ||
---@param event_name string | ||
---@param callback fun(data:any) | ||
function M.listen(event_name, callback) | ||
if not M.listeners[event_name] then | ||
M.listeners[event_name] = {} | ||
end | ||
table.insert(M.listeners[event_name], callback) | ||
end | ||
|
||
return M |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters