Skip to content

Commit 27c0d50

Browse files
committed
fix(component): update click function deferment
1 parent a310ab1 commit 27c0d50

File tree

1 file changed

+5
-14
lines changed

1 file changed

+5
-14
lines changed

lua/astroui/status/component.lua

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -193,9 +193,7 @@ function M.git_branch(opts)
193193
on_click = {
194194
name = "heirline_branch",
195195
callback = function()
196-
if is_available "telescope.nvim" then
197-
vim.defer_fn(function() require("telescope.builtin").git_branches { use_file_path = true } end, 100)
198-
end
196+
if is_available "telescope.nvim" then require("telescope.builtin").git_branches { use_file_path = true } end
199197
end,
200198
},
201199
update = { "User", pattern = "GitSignsUpdate" },
@@ -217,9 +215,7 @@ function M.git_diff(opts)
217215
on_click = {
218216
name = "heirline_git",
219217
callback = function()
220-
if is_available "telescope.nvim" then
221-
vim.defer_fn(function() require("telescope.builtin").git_status { use_file_path = true } end, 100)
222-
end
218+
if is_available "telescope.nvim" then require("telescope.builtin").git_status { use_file_path = true } end
223219
end,
224220
},
225221
surround = { separator = "left", color = "git_diff_bg", condition = condition.git_changed },
@@ -252,9 +248,7 @@ function M.diagnostics(opts)
252248
on_click = {
253249
name = "heirline_diagnostic",
254250
callback = function()
255-
if is_available "telescope.nvim" then
256-
vim.defer_fn(function() require("telescope.builtin").diagnostics() end, 100)
257-
end
251+
if is_available "telescope.nvim" then require("telescope.builtin").diagnostics() end
258252
end,
259253
},
260254
update = { "DiagnosticChanged", "BufEnter" },
@@ -320,9 +314,7 @@ function M.lsp(opts)
320314
surround = { separator = "right", color = "lsp_bg", condition = condition.lsp_attached },
321315
on_click = {
322316
name = "heirline_lsp",
323-
callback = function()
324-
vim.defer_fn(function() vim.cmd.LspInfo() end, 100)
325-
end,
317+
callback = function() vim.schedule(vim.cmd.LspInfo) end,
326318
},
327319
}, opts)
328320
return M.builder(status_utils.setup_providers(
@@ -390,8 +382,7 @@ function M.numbercolumn(opts)
390382
callback = function(...)
391383
local args = status_utils.statuscolumn_clickargs(...)
392384
if args.mods:find "c" then
393-
local dap_avail, dap = pcall(require, "dap")
394-
if dap_avail then vim.schedule(dap.toggle_breakpoint) end
385+
if is_available "nvim-dap" then require("dap").toggle_breakpoint() end
395386
end
396387
end,
397388
},

0 commit comments

Comments
 (0)