Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an option to disable each timer #12

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ ins_left {
message = { commenced = 'In Progress', completed = 'Completed' },
},
display_components = { 'lsp_client_name', 'spinner', { 'title', 'percentage', 'message' } },
-- Each of these can be set to false to disable the timer
timer = { progress_enddelay = 500, spinner = 1000, lsp_client_name_enddelay = 1000 },
spinner_symbols = { '🌑 ', '🌒 ', '🌓 ', '🌔 ', '🌕 ', '🌖 ', '🌗 ', '🌘 ' },
}
Expand Down
10 changes: 10 additions & 0 deletions lua/lualine/components/lsp_progress.lua
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ LspProgress.default = {
spinner = { pre = '', post = '' },
},
display_components = { 'lsp_client_name', 'spinner', { 'title', 'percentage', 'message' } },
-- Each of these can be set to false to disable the timer
timer = { progress_enddelay = 500, spinner = 500, lsp_client_name_enddelay = 1000 },
spinner_symbols_dice = { ' ', ' ', ' ', ' ', ' ', ' ' }, -- Nerd fonts needed
spinner_symbols_moon = { '🌑 ', '🌒 ', '🌓 ', '🌔 ', '🌕 ', '🌖 ', '🌗 ', '🌘 ' },
Expand Down Expand Up @@ -104,10 +105,16 @@ LspProgress.register_progress = function(self)
progress.percentage = '100'
end
progress.message = self.options.message.completed
if self.options.timer.progress_enddelay == false then
return
end
vim.defer_fn(function()
if self.clients[client_key] then
self.clients[client_key].progress[key] = nil
end
if self.options.timer.lsp_client_name_enddelay == false then
return
end
vim.defer_fn(function()
local has_items = false
if self.clients[client_key] and self.clients[client_key].progress then
Expand Down Expand Up @@ -209,6 +216,9 @@ LspProgress.setup_spinner = function(self)
self.spinner.index = 0
self.spinner.symbol_mod = #self.options.spinner_symbols
self.spinner.symbol = self.options.spinner_symbols[1]
if self.options.timer.spinner == false then
return
end
local timer = vim.loop.new_timer()
timer:start(0, self.options.timer.spinner,
function()
Expand Down