goolord / alpha-nvim

a lua powered greeter like vim-startify / dashboard-nvim
MIT License
1.78k stars 104 forks source link

Empty button is allowed, but it throws error #217

Closed Zeioth closed 1 year ago

Zeioth commented 1 year ago

I'm trying to create an emply button row like this

 dashboard.section.buttons.val = {
     dashboard.button( "n", "📄  New     " , ':ene <BAR> startinsert <CR>'),
     dashboard.button( "e", "🪿  Recent  " , ':Telescope oldfiles<CR>'),
     dashboard.button( "r", "🐍  Ranger  " , ':Ranger<CR>'),
     dashboard.button( "s", "🔎  Sessions" , 'SessionManager! load_session<CR>'),
     dashboard.button( "p", "💼  Projects" , ':Telescope projects<CR>'),
     dashboard.button( "  ", " " , ' '), -- < ----This one
     dashboard.button( "q", "quit"         , ':exit<CR>'),
     --  --button("LDR f '", "  Bookmarks  "),
 }

You can see the result is the expected. It leaves an emply line with no action. screenshot_2023-05-22_00-32-22_245613975

The problem is this provokes an error in alpha. screenshot_2023-05-22_00-34-37_957827745

goolord commented 1 year ago

yeah i have pretty much no interest in fixing this. it's an interpreted & dynamically typed language, adding robust error checking would not only pollute the code but also come at a runtime cost. doing something bad and seeing an error message is good enough

goolord commented 1 year ago

you don't need a button, you can just use a padding element or something

Zeioth commented 1 year ago

It worked fine without errors using 2 arguments instead of 3 thank you.

      dashboard.section.buttons.val = {
        dashboard.button("n", "📄 New     ", ':ene<CR>'),
        dashboard.button("e", "🌺 Recent  ", ':Telescope oldfiles<CR>'),
        dashboard.button("r", "🐍 Ranger  ", ':Ranger<CR>'),
        dashboard.button("s", "🔎 Sessions", 'SessionManager! load_session<CR>'),
        dashboard.button("p", "💼 Projects", ':Telescope projects<CR>'),
        dashboard.button("", ""),   -- <---- 2 arguments instead of 3
        dashboard.button("q", "   Quit", ':exit<CR>'),
      }