arkav / lualine-lsp-progress

LSP Progress lualine componenet
MIT License
227 stars 18 forks source link

Struggling to get non-default config #7

Closed hlmtre closed 2 years ago

hlmtre commented 2 years ago

Hi! First off, thanks for this plugin; it's beautiful.

I'm struggling to get a non-default configuration of this plugin going. I've included the code chunk in the README at the beginning of my plugins.lua, and it does successfully load the lsp_progress component in lualine, but I actually had to modify lualine-lsp-progress's source to change the default-if-unset symbol from the block to the moon (which is, incidentally fabulous - I assume a reference to Lua meaning 'moon').

Anyway, relevant config below. This does not work - I still get the block spinners, instead of the moons.

plugins.lua ```lua -- Color for highlights local colors = { yellow = '#ECBE7B', cyan = '#008080', darkblue = '#081633', green = '#98be65', orange = '#FF8800', violet = '#a9a1e1', magenta = '#c678dd', blue = '#51afef', red = '#ec5f67' } local lualine_config = { options = { icons_enabled = true, theme = 'gruvbox', lower = true, component_separators = {'', ''}, section_separators = {'', ''}, disabled_filetypes = {} }, sections = { lualine_a = {'mode'}, lualine_b = {'filename', 'branch', {'diagnostics', sources = {'nvim_lsp'}}}, lualine_c = {}, lualine_x = {}, lualine_y = {'encoding', 'fileformat', 'filetype'}, lualine_z = {'progress','location'}, }, -- these aren't off; these are what are on when the window is unfocused inactive_sections = { lualine_a = {}, lualine_b = {}, lualine_c = {'filename'}, lualine_x = {'location'}, lualine_y = {}, lualine_z = {} }, tabline = {}, extensions = {"nvim-tree", "quickfix"} } -- Inserts a component in lualine_c at left section local function ins_left(component) table.insert(lualine_config.sections.lualine_c, component) end ins_left { 'lsp_progress', colors = { percentage = colors.cyan, title = colors.cyan, message = colors.cyan, spinner = colors.cyan, lsp_client_name = colors.magenta, use = true, }, separators = { component = ' ', progress = ' | ', percentage = { pre = '', post = '%% ' }, title = { pre = '', post = ': ' }, lsp_client_name = { pre = '[', post = ']' }, spinner = { pre = '', post = '' }, message = { commenced = 'In Progress', completed = 'Completed' }, }, display_components = { 'lsp_client_name', 'spinner', { 'title', 'percentage', 'message' } }, timer = { progress_enddelay = 500, spinner = 1000, lsp_client_name_enddelay = 1000 }, spinner_symbols = { '🌑 ', '🌒 ', '🌓 ', '🌔 ', '🌕 ', '🌖 ', '🌗 ', '🌘 ' }, } ... use({ "nvim-lualine/lualine.nvim", config = function() require('lualine').setup({ extensions = lualine_config.extensions, options = lualine_config.options, sections = lualine_config.sections, inactive_sections = lualine_config.inactive_sections, }) end, }) ```

I assume I'm making a silly mistake, which will likely become obvious when you point it out. Thanks!

arkav commented 2 years ago

Hello, it looks like your using packer lazy loading. Since lualine_config is defined as a local variable, when packer executes its compiled script it doesn't see anything outside the scope of your config function.

hlmtre commented 2 years ago

Baller. Thanks for the suggestion! I'll give it a shot.

On Thu, Oct 28, 2021 at 9:02 PM arkav @.***> wrote:

Hello, it looks like your using packer lazy loading. Since lualine_config is defined as a local variable, when packer executes its compiled script it doesn't see anything outside the scope of your config function.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/arkav/lualine-lsp-progress/issues/7#issuecomment-954411365, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADNGGJMH4NXQHUPF6KOV3TUJIME7ANCNFSM5GUDSYSA .