Use vim.notify not to block outputs (#75)

This commit is contained in:
JINNOUCHI Yasushi 2022-09-28 04:03:57 +09:00 committed by GitHub
parent d51c7631dc
commit 4d72ee8002
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 5 deletions

View File

@ -27,7 +27,7 @@ local function import_oldfiles()
for _, filepath in pairs(oldfiles) do for _, filepath in pairs(oldfiles) do
sql_wrapper:update(filepath) sql_wrapper:update(filepath)
end end
print(("Telescope-Frecency: Imported %d entries from oldfiles."):format(#oldfiles)) vim.notify(("Telescope-Frecency: Imported %d entries from oldfiles."):format(#oldfiles))
end end
local function file_is_ignored(filepath) local function file_is_ignored(filepath)
@ -65,7 +65,7 @@ local function validate_db(safe_mode)
if user_response == 1 then if user_response == 1 then
confirmed = true confirmed = true
else else
vim.defer_fn(function() print("TelescopeFrecency: validation aborted.") end, 50) vim.defer_fn(function() vim.notify("TelescopeFrecency: validation aborted.") end, 50)
end end
else else
confirmed = true confirmed = true
@ -78,9 +78,9 @@ local function validate_db(safe_mode)
sql_wrapper:do_transaction(queries.file_delete_entry , {where = {id = entry.id }}) sql_wrapper:do_transaction(queries.file_delete_entry , {where = {id = entry.id }})
sql_wrapper:do_transaction(queries.timestamp_delete_entry, {where = {file_id = entry.id}}) sql_wrapper:do_transaction(queries.timestamp_delete_entry, {where = {file_id = entry.id}})
end end
print(('Telescope-Frecency: removed %d missing entries.'):format(#pending_remove)) vim.notify(('Telescope-Frecency: removed %d missing entries.'):format(#pending_remove))
else else
print("Telescope-Frecency: validation aborted.") vim.notify("Telescope-Frecency: validation aborted.")
end end
end end
end end

View File

@ -45,7 +45,7 @@ function M:bootstrap(db_root)
local db_filename = db_root .. "/file_frecency.sqlite3" local db_filename = db_root .. "/file_frecency.sqlite3"
self.db = sqlite:open(db_filename) self.db = sqlite:open(db_filename)
if not self.db then if not self.db then
print("error") vim.notify("Telescope-Frecency: error in opening DB", vim.log.levels.ERROR)
return return
end end