Skip to content

Commit

Permalink
chore: return early for debug function
Browse files Browse the repository at this point in the history
  • Loading branch information
dhruvmanila committed Aug 7, 2022
1 parent 083a58c commit 1ae294d
Showing 1 changed file with 17 additions and 15 deletions.
32 changes: 17 additions & 15 deletions lua/telescope/_extensions/bookmarks/utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,26 @@ local path_sep = require("plenary.path").path.sep
---function and then shown.
---@vararg any
function utils.debug(...)
if _TELESCOPE_BOOKMARKS_DEBUG then
local parts = {}
for i = 1, select("#", ...) do
local arg = select(i, ...)
if arg == nil then
table.insert(parts, "nil")
else
table.insert(parts, vim.inspect(arg))
end
if not _TELESCOPE_BOOKMARKS_DEBUG then
return
end

local parts = {}
for i = 1, select("#", ...) do
local arg = select(i, ...)
if arg == nil then
table.insert(parts, "nil")
else
table.insert(parts, vim.inspect(arg))
end
end

vim.api.nvim_out_write(
("[telescope-bookmarks] [%s] [DEBUG]: %s\n"):format(
os.date "%Y-%m-%d %H:%M:%S",
table.concat(parts, " ")
)
vim.api.nvim_out_write(
("[telescope-bookmarks] [%s] [DEBUG]: %s\n"):format(
os.date "%Y-%m-%d %H:%M:%S",
table.concat(parts, " ")
)
end
)
end

---Emit a warning message.
Expand Down

0 comments on commit 1ae294d

Please sign in to comment.